ci: gated release pipeline (npm Trusted Publishing + GitHub Release) - #5
Open
alexanderolvera wants to merge 2 commits into
Open
ci: gated release pipeline (npm Trusted Publishing + GitHub Release)#5alexanderolvera wants to merge 2 commits into
alexanderolvera wants to merge 2 commits into
Conversation
Tag-triggered release workflow. Pushing a vX.Y.Z tag runs a verify job (tag/version match, refuse-republish guard, build, typecheck, lint, test, pack) then a publish job gated behind a protected `npm-production` Environment. Publish uses npm Trusted Publishing (OIDC, provenance) with no stored token, promotes the tarball built in verify, and creates a matching GitHub Release with notes extracted from CHANGELOG.md. Changelog extraction is literal-substring (regex-free) so it behaves the same across awk flavors and won't pull in the trailing link-reference block. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a tag-triggered GitHub Actions release workflow for this npm package, building and verifying once, then using a protected Environment as a manual approval gate before publishing via npm Trusted Publishing (OIDC + provenance) and creating a matching GitHub Release.
Changes:
- Introduces a
verifyjob that validates tag/version alignment, checks npm for an existing version, runs CI steps, and uploads a single built tarball artifact. - Introduces a gated
publishjob (environment:npm-production) that downloads the promoted tarball, publishes to npm with provenance, and creates a GitHub Release with notes extracted fromCHANGELOG.md(or autogenerated as fallback).
Comment on lines
+41
to
+43
| verify: | ||
| runs-on: ubuntu-latest | ||
| steps: |
Comment on lines
+90
to
+92
| permissions: | ||
| contents: write # create the GitHub Release | ||
| id-token: write # OIDC for npm Trusted Publishing + provenance |
Comment on lines
+111
to
+114
| set -euo pipefail | ||
| tgz=$(ls release-artifact/*.tgz) | ||
| echo "Publishing $tgz" | ||
| npm publish "$tgz" --provenance --access public |
| flag && substr($0, 1, 1) == "[" { exit } | ||
| flag { print } | ||
| ' CHANGELOG.md) | ||
| tgz=$(ls release-artifact/*.tgz) |
Comment on lines
+101
to
+103
| - name: Use an npm new enough for OIDC trusted publishing | ||
| run: npm install -g npm@latest | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
.github/workflows/release.yml— a tag-triggered release pipeline that publishes to npm and cuts a matching GitHub Release, with an Azure-DevOps-style manual approval gate before publish.How you cut a release
The
v*tag push triggers the workflow.Flow
Job 1 —
verify(no special perms):package.jsonversion (fails otherwise).npm ci→ build → typecheck → lint → test.npm pack→ upload the tarball as an artifact (built once, promoted).Job 2 —
publish(needs: verify,environment: npm-production):id-token: write) — no storedNPM_TOKEN— with a provenance attestation.CHANGELOG.mdsection (regex-free extraction; autogenerated notes as fallback).One-time setup (required before the first tag)
npm-production→ enable Required reviewers, add yourself.alexanderolvera/dfhack-remote-node, workflowrelease.yml, environmentnpm-production.Provenance requires the repo to stay public (it is).
GitHub vs Azure DevOps note
GitHub has no separate "Releases pipeline" entity — this is a normal workflow. The ADO release-approval gate maps to a protected Environment with required reviewers; artifact promotion maps to
upload-artifact→download-artifactacross jobs.🤖 Generated with Claude Code