From e2f06b2a208348d45d4eb628d2137e5f8bb6f0d5 Mon Sep 17 00:00:00 2001 From: danielshih Date: Wed, 1 Jan 2025 10:50:29 +0800 Subject: [PATCH] enhance build flow --- .github/workflows/dotnet_build.yml | 12 ++++ .github/workflows/github_rel.yml | 90 ------------------------------ 2 files changed, 12 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/github_rel.yml diff --git a/.github/workflows/dotnet_build.yml b/.github/workflows/dotnet_build.yml index 06173e0..7324cc3 100644 --- a/.github/workflows/dotnet_build.yml +++ b/.github/workflows/dotnet_build.yml @@ -28,6 +28,18 @@ jobs: run: dotnet test --no-build --verbosity normal --configuration Release working-directory: src/tests/MessageWorkerPool.Test + - name: Package Release Artifacts + run: | + mkdir -p release + cp -r ./MessageWorkerPool/bin/Release/* release/ + working-directory: ./src + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: ./src/release/ + - name: Pack NuGet Package run: dotnet pack --no-build --configuration Release --output ./nupkg working-directory: ./src diff --git a/.github/workflows/github_rel.yml b/.github/workflows/github_rel.yml deleted file mode 100644 index db2fd1f..0000000 --- a/.github/workflows/github_rel.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Build and Release - -on: - push: - tags: - - 'v*' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 6.0.x - - - name: Restore dependencies - run: dotnet restore - working-directory: ./src - - - name: Build - run: dotnet build --configuration Release - working-directory: ./src - - - name: Test - run: dotnet test --no-build --verbosity normal --configuration Release - working-directory: src/tests/MessageWorkerPool.Test - - - name: Package Release Artifacts - run: | - mkdir -p release - cp -r ./MessageWorkerPool/bin/Release/* release/ - working-directory: ./src - - - name: Upload Build Artifacts - uses: actions/upload-artifact@v3 - with: - name: build-artifacts - path: ./src/release/ - - release: - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/checkout@v2 - - - name: Read Release Notes - id: read_notes - run: | - TAG_VERSION=${{ github.ref_name }} - RELEASE_NOTE_FILE="./release_note/release.${TAG_VERSION#v}.md" - - # Check if the release note file exists - if [[ -f $RELEASE_NOTE_FILE ]]; then - RELEASE_NOTES=$(cat "$RELEASE_NOTE_FILE") - echo "release_body=$RELEASE_NOTES" >> $GITHUB_ENV - else - echo "Error: Release note file not found for version $TAG_VERSION!" - exit 1 - fi - - - name: Download Build Artifacts - uses: actions/download-artifact@v3 - with: - name: build-artifacts - - - - name: Create GitHub Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: Release ${{ github.ref_name }} - body: | - ${{ env.release_body }} - draft: false - prerelease: false - - - name: Upload Release Assets - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./src/release/ - asset_name: application.zip - asset_content_type: application/zip