From 5c80a5551c5a5b618b61b66409d440b0c2c87d9d Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Sat, 14 Nov 2026 21:05:52 +0000 Subject: [PATCH] The NuGet workflow publishes an existing tag by hand A release event runs the workflow as it stood at the tagged commit, so a release whose publish failed cannot be retried under a newer workflow by re-running it. A workflow_dispatch with the tag checks the tag out and packs it as the release would, with the login from the default branch's workflow, which is the one the trusted-publishing policy names. The tag reaches the shell through the environment rather than interpolated into the script. 2.7.0's run failed on the expired API key before #2444; this publishes it. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/Nuget.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Nuget.yml b/.github/workflows/Nuget.yml index b11282c18..e2a4d03dd 100644 --- a/.github/workflows/Nuget.yml +++ b/.github/workflows/Nuget.yml @@ -3,6 +3,13 @@ name: 'Upload to NuGet' on: release: types: [published] + # Publishes the packages of a tag that already has a release, when the run its release started failed + # after the release was published. The packages are built from the tag, as a release builds them. + workflow_dispatch: + inputs: + tag: + description: 'The tag of a published release, such as v2.7.0' + required: true jobs: publish: @@ -17,11 +24,15 @@ jobs: dotnet-version: '10.x' - uses: actions/checkout@v6 + with: + ref: ${{ github.event.release.tag_name || inputs.tag }} - name: 'Determine version' id: version + env: + TAGNAME: ${{ github.event.release.tag_name || inputs.tag }} run: | - tagname="${{ github.event.release.tag_name }}" + tagname="$TAGNAME" # Validate tag name exists if [[ -z "$tagname" ]]; then