Skip to content

Commit 5ec47ae

Browse files
The NuGet workflow publishes an existing tag by hand (#2445)
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 <noreply@anthropic.com>
1 parent fbbce18 commit 5ec47ae

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎.github/workflows/Nuget.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name: 'Upload to NuGet'
33
on:
44
release:
55
types: [published]
6+
# Publishes the packages of a tag that already has a release, when the run its release started failed
7+
# after the release was published. The packages are built from the tag, as a release builds them.
8+
workflow_dispatch:
9+
inputs:
10+
tag:
11+
description: 'The tag of a published release, such as v2.7.0'
12+
required: true
613

714
jobs:
815
publish:
@@ -17,11 +24,15 @@ jobs:
1724
dotnet-version: '10.x'
1825

1926
- uses: actions/checkout@v6
27+
with:
28+
ref: ${{ github.event.release.tag_name || inputs.tag }}
2029

2130
- name: 'Determine version'
2231
id: version
32+
env:
33+
TAGNAME: ${{ github.event.release.tag_name || inputs.tag }}
2334
run: |
24-
tagname="${{ github.event.release.tag_name }}"
35+
tagname="$TAGNAME"
2536
2637
# Validate tag name exists
2738
if [[ -z "$tagname" ]]; then

0 commit comments

Comments
 (0)