Skip to content

Commit 2bb8179

Browse files
JordanMarrclaude
andcommitted
Add NuGet Trusted Publishing workflow
Manually-triggered GitHub Actions workflow that tests, packs, and pushes to nuget.org via Trusted Publishing (OIDC token exchange through NuGet/login) instead of a stored API key. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FrmC1EQmyB68Tqsn3EG7UA
1 parent 217af37 commit 2bb8179

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Publishes FSharp.SystemCommandLine to nuget.org using Trusted Publishing (OIDC).
2+
# No stored API key: NuGet/login exchanges a GitHub-issued OIDC token for a
3+
# short-lived (1 hour) API key, validated against the trusted publishing policy
4+
# configured on nuget.org for this repository + workflow file.
5+
#
6+
# Trigger manually from the Actions tab (Run workflow) after bumping <Version>
7+
# in the fsproj. The version in the fsproj determines the published version.
8+
9+
name: Publish to NuGet
10+
11+
on:
12+
workflow_dispatch:
13+
14+
jobs:
15+
publish:
16+
runs-on: windows-2022
17+
18+
permissions:
19+
id-token: write # required for GitHub OIDC token issuance (Trusted Publishing)
20+
contents: read
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: 6.0.x
29+
30+
- name: Test
31+
run: dotnet test src/Tests/Tests.fsproj --configuration Release
32+
33+
- name: Pack
34+
run: dotnet pack src/FSharp.SystemCommandLine/FSharp.SystemCommandLine.fsproj --configuration Release --output artifacts
35+
36+
- name: NuGet login (OIDC -> temp API key)
37+
uses: NuGet/login@v1
38+
id: login
39+
with:
40+
user: "jordan marr" # nuget.org profile name (not email)
41+
42+
- name: Push
43+
run: dotnet nuget push artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)