Skip to content

Add a release workflow that publishes to NuGet with Trusted Publishing - #2

Merged
archofthings merged 1 commit into
mainfrom
claude/release-workflow
Oct 1, 2026
Merged

archofthings merged 1 commit into
mainfrom
claude/release-workflow

Conversation

@archofthings

@archofthings archofthings commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Adds .github/workflows/release.yml, which publishes Cimon.Net to nuget.org and creates a GitHub release. NuGet currently has only 1.0.0, so this is what will publish 2.0.0.

How it runs

  • On a pushed v* tag, for example v2.1.0.
  • By hand from the Actions tab (Run workflow, then enter a tag). This releases a tag that already exists, such as the current v2.0.0, which points at main, without deleting and re-creating it.

Steps

  1. Checks out the tag and checks that it matches <Version> in CimonPlc.csproj.
  2. Runs the tests (sets up the .NET 8 and 10 SDKs, like CI).
  3. Packs Cimon.Net.<version>.nupkg and the .snupkg symbols package.
  4. Takes the release notes from that version's section in CHANGELOG.md, falling back to a changelog link.
  5. Logs in with NuGet/login@v1 (Trusted Publishing): a GitHub OIDC token is exchanged for an API key that expires after about an hour, so no NuGet key is stored in the repository.
  6. Pushes the package and symbols to nuget.org with --skip-duplicate, so re-runs are safe.
  7. Creates the GitHub release "Cimon.Net " with the changelog notes and both package files.

Setup needed before running it

  • A Trusted Publishing policy on nuget.org: owner archofthings, repository Cimon.Net, workflow release.yml, package Cimon.Net, scope "push only new package versions".
  • A repository secret NUGET_USER with the nuget.org profile name.

Testing

  • dotnet test -c Release: 149 tests pass.
  • dotnet pack produces Cimon.Net.2.0.0.nupkg and Cimon.Net.2.0.0.snupkg.
  • The changelog extraction outputs exactly the ## 2.0.0 section.
  • The workflow YAML parses. The workflow itself only runs on a tag or by hand, so its first real run will be the 2.0.0 release. The same Trusted Publishing setup published Rony.Net 1.0.0 successfully.

After merging

Go to Actions → Release → Run workflow, keep the branch as main, and enter the tag v2.0.0.

Runs on a pushed v* tag, or by hand for an existing tag. It checks the
tag matches the package version, tests, packs, publishes to nuget.org
through NuGet Trusted Publishing (no stored API key) and creates a GitHub
release whose notes come from that version's CHANGELOG.md section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZbQj8GuvpB7Qn8LueTNWw
@archofthings
archofthings merged commit 492d365 into main Oct 1, 2026
2 checks passed
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@archofthings
archofthings deleted the claude/release-workflow branch October 8, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants