Skip to content

Commit 5b97d12

Browse files
Copilotdadhi
andauthored
docs: add inline comments to publish.yml explaining GITHUB_TOKEN and NUGET_API_KEY setup
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/15fdb866-55dd-4b04-8aaa-b43dc6431c81 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
1 parent 299fc3a commit 5b97d12

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
name: Publish
22

3+
# Triggered automatically when a tag matching "v*.*.*" is pushed, e.g. `git tag v5.4.1 && git push --tags`
4+
35
on:
46
push:
57
tags:
68
- "v*.*.*"
79

10+
# Required secrets / permissions:
11+
#
12+
# 1. secrets.GITHUB_TOKEN — automatically injected by GitHub Actions for every run; no setup required.
13+
# It is used to authenticate pushes to GitHub Packages (https://nuget.pkg.github.com/dadhi/index.json).
14+
# The token only needs `packages: write` permission, which is already granted to GITHUB_TOKEN by default
15+
# for public repos. If you ever restrict default permissions, add:
16+
# permissions:
17+
# packages: write
18+
# at the job level.
19+
#
20+
# 2. secrets.NUGET_API_KEY — a personal API key for https://www.nuget.org.
21+
# How to obtain and store it:
22+
# a. Log in to https://www.nuget.org → account menu → "API Keys" → "Create".
23+
# b. Set the key scope to "Push" and select the relevant package IDs (or use a glob).
24+
# c. Copy the generated key.
25+
# d. In this GitHub repo go to Settings → Secrets and variables → Actions → "New repository secret".
26+
# e. Name it exactly NUGET_API_KEY and paste the key as the value.
27+
828
jobs:
929
build:
1030
runs-on: ubuntu-latest
@@ -19,6 +39,7 @@ jobs:
1939
with:
2040
global-json-file: global.json
2141

42+
# The classic NuGet CLI is required because .nuspec files are not supported by `dotnet pack`.
2243
- name: Install NuGet CLI
2344
run: sudo apt-get install -y nuget
2445

@@ -31,6 +52,7 @@ jobs:
3152

3253
- name: Pack
3354
run: |
55+
# GITHUB_REF_NAME is the tag name, e.g. "v5.4.1"; strip the leading "v" to get the NuGet version.
3456
VERSION="${GITHUB_REF_NAME#v}"
3557
echo "Packing version: $VERSION"
3658
mkdir -p artifacts
@@ -44,10 +66,15 @@ jobs:
4466
name: Packages
4567
path: ./artifacts
4668

69+
# Pushes to the GitHub Packages NuGet feed for this repository.
70+
# GITHUB_TOKEN is provided automatically — no manual secret setup needed.
71+
# --store-password-in-clear-text is required on Linux because the system credential store is unavailable;
72+
# it is safe here because GitHub Actions runners are ephemeral and credentials are never persisted.
4773
- name: Push to GitHub Packages
4874
run: |
4975
dotnet nuget add source --username dadhi --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/dadhi/index.json"
5076
dotnet nuget push artifacts/*.nupkg --source github --skip-duplicate
5177
78+
# Pushes to nuget.org. Requires the NUGET_API_KEY secret (see setup instructions above).
5279
- name: Push to NuGet.org
5380
run: dotnet nuget push artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)