From 700544f6abe7fe61c6991ef4ee7177b07f60fb2f Mon Sep 17 00:00:00 2001 From: Benziza Date: Thu, 17 Sep 2026 21:30:45 +0200 Subject: [PATCH 1/2] ci: add manual NuGet publishing workflow --- .github/workflows/publish-nuget.yml | 32 +++++++++++++++++++++++++++++ docs/RELEASING.md | 10 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/publish-nuget.yml create mode 100644 docs/RELEASING.md diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 0000000..ca12b64 --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -0,0 +1,32 @@ +name: Publish NuGet tool + +on: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: nuget-publish + cancel-in-progress: false + +jobs: + publish: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.4xx' + - run: dotnet test WhyConfig.slnx -c Release + - run: dotnet pack src/WhyConfig.Cli/WhyConfig.Cli.csproj -c Release --no-restore -o artifacts + - name: Publish to NuGet.org + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: | + if [ -z "$NUGET_API_KEY" ]; then + echo "Set the NUGET_API_KEY repository secret before publishing." >&2 + exit 1 + fi + dotnet nuget push artifacts/WhyConfig.NET.*.nupkg --source https://api.nuget.org/v3/index.json diff --git a/docs/RELEASING.md b/docs/RELEASING.md new file mode 100644 index 0000000..9ba9305 --- /dev/null +++ b/docs/RELEASING.md @@ -0,0 +1,10 @@ +# Releasing WhyConfig.NET + +The GitHub repository can stay private while the tool package is public on NuGet.org. + +1. Create a NuGet.org account and a [Push API key](https://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-an-api-key). For the first release, allow new packages in the key's package scope. +2. Save the key as the `NUGET_API_KEY` secret in this repository's **Settings → Secrets and variables → Actions**. Do not commit the key. +3. Run the **Publish NuGet tool** workflow from `main` in the Actions tab. +4. After NuGet.org lists the package, verify installation with `dotnet tool install --global WhyConfig.NET` and `whyconfig --help`. + +For another release, change `Version` in `src/WhyConfig.Cli/WhyConfig.Cli.csproj`, merge it, then run the workflow again. NuGet.org does not allow replacing a published package version. From 3946d0dc32b485110789451bb0e42938a448c87f Mon Sep 17 00:00:00 2001 From: Benziza Date: Thu, 17 Sep 2026 21:32:03 +0200 Subject: [PATCH 2/2] chore: credit Benziza as package author --- docs/RELEASING.md | 2 +- src/WhyConfig.Cli/WhyConfig.Cli.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 9ba9305..88538c2 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -2,7 +2,7 @@ The GitHub repository can stay private while the tool package is public on NuGet.org. -1. Create a NuGet.org account and a [Push API key](https://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-an-api-key). For the first release, allow new packages in the key's package scope. +1. Sign in to the [Benziza NuGet.org account](https://www.nuget.org/profiles/Benziza) and create a [Push API key](https://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-an-api-key). For the first release, allow new packages in the key's package scope. 2. Save the key as the `NUGET_API_KEY` secret in this repository's **Settings → Secrets and variables → Actions**. Do not commit the key. 3. Run the **Publish NuGet tool** workflow from `main` in the Actions tab. 4. After NuGet.org lists the package, verify installation with `dotnet tool install --global WhyConfig.NET` and `whyconfig --help`. diff --git a/src/WhyConfig.Cli/WhyConfig.Cli.csproj b/src/WhyConfig.Cli/WhyConfig.Cli.csproj index ee0635b..d43dae1 100644 --- a/src/WhyConfig.Cli/WhyConfig.Cli.csproj +++ b/src/WhyConfig.Cli/WhyConfig.Cli.csproj @@ -20,7 +20,7 @@ whyconfig WhyConfig.NET 0.1.0 - WhyConfig.NET + Benziza Explain .NET configuration provider precedence for a key. README.md