From c7f6fae39c51b9396bca915a817b6741d0147468 Mon Sep 17 00:00:00 2001 From: Gaoyang Date: Wed, 16 Sep 2026 00:13:36 +0800 Subject: [PATCH] ci: create GitHub release once from collected artifacts Matrix release jobs each created a draft release concurrently, which raced and produced duplicate drafts for the same tag; finalizing then failed with "already_exists" on tag_name. Upload the per-RID archives as workflow artifacts instead and let finalize-release download them and create the release in a single step. Narrow the matrix job permission to contents: read since it no longer writes releases. --- .github/workflows/ci.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e5852c..96a2799 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: archive: tar.gz runs-on: ${{ matrix.os }} permissions: - contents: write + contents: read steps: - uses: actions/checkout@v4 with: @@ -75,11 +75,12 @@ jobs: run: | tar -czf aimon-cli-${{ github.ref_name }}-${{ matrix.rid }}.tar.gz -C publish/${{ matrix.rid }} . - - name: Upload to release - uses: softprops/action-gh-release@v2 + - name: Upload build artifact + uses: actions/upload-artifact@v4 with: - draft: true - files: aimon-cli-${{ github.ref_name }}-${{ matrix.rid }}.* + name: aimon-cli-${{ matrix.rid }} + path: aimon-cli-${{ github.ref_name }}-${{ matrix.rid }}.* + if-no-files-found: error finalize-release: name: Finalize release notes @@ -89,13 +90,21 @@ jobs: permissions: contents: write steps: - - name: Set title, generate notes, and publish + - name: Download all build artifacts + uses: actions/download-artifact@v4 + with: + pattern: aimon-cli-* + path: dist + merge-multiple: true + + - name: Create release with all assets uses: softprops/action-gh-release@v2 with: name: AIUsageMonitor ${{ github.ref_name }} prerelease: ${{ contains(github.ref_name, '-') }} generate_release_notes: true draft: false + files: dist/* publish-nuget: name: Publish dotnet tool to NuGet