From 9024048aaef287ce0e260ddfacdb73b45e06b49a Mon Sep 17 00:00:00 2001 From: Stuart Meeks Date: Sun, 3 May 2026 04:42:34 +0000 Subject: [PATCH] add release.yml + factor publish out of ci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tag-driven publish to nuget.org now lives in its own workflow file (matches the layout the user asked for; aligned with how the Auth repo gates publishing on `refs/tags/v*`). - .github/workflows/release.yml — triggers on `v*` tag push. Restore → build → test → pack → upload-artifact → nuget push --skip-duplicate. Self-contained: doesn't depend on a CI workflow run completing first. - .github/workflows/ci.yml — drops the `tags` trigger and the publish job. CI now runs only on push-to-main and PRs; release.yml owns the tag flow end-to-end. Repo needs a NUGET_API_KEY secret for the push to succeed. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 28 +++-------------------- .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c10eb9..c0fdfad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,11 +3,12 @@ name: CI env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true +# Build + test + pack on every push to main and every PR. Tag pushes are +# handled by .github/workflows/release.yml — that workflow runs the same +# build/test plus publishes to nuget.org. on: push: branches: [ main ] - tags: - - 'v*' pull_request: branches: [ main ] @@ -57,26 +58,3 @@ jobs: - name: Test run: dotnet test --configuration Release --verbosity normal - - publish: - needs: [ build, test ] - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Setup .NET 10 - uses: actions/setup-dotnet@v5 - with: - dotnet-version: '10.0.x' - - - name: Download artifact - uses: actions/download-artifact@v7 - with: - name: nuget-package - path: ./artifacts - - - name: Publish to NuGet - run: dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c87eddf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup .NET 10 + uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.x' + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Pack + run: dotnet pack --configuration Release --no-build --output ./artifacts + + - name: Upload package artifact + uses: actions/upload-artifact@v6 + with: + name: nuget-package + path: ./artifacts/*.nupkg + + - name: Publish to NuGet + run: dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate