Repository navigation
ci: add tag-triggered npm release workflow for keygate-client - #4
Conversation
The package was only installable from git. A tag push now installs from the lockfile, checks, builds, publishes with provenance, and creates the release; a tag that disagrees with package.json fails before either of those run. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
|
nice implementation but ...What’s missing Validation log (an acceptance criterion). The issue requires a --dry-run on a test tag or an act run, with the log linked in the PR. The description lists how to verify, and its checklist includes this item, but I saw no log linked. The mismatch failure is correct in the code but unproven. Smaller points Permissions: the issue says contents: read, but the release step needs contents: write, so the job has write access. That’s a reasonable call, but splitting publish and release into separate jobs would keep the publish step at read-only. |
The release step needs contents: write, which the publish step should not have, so the two are separate jobs. A manual run now stops before upload, which makes the tag check and the tarball check testable without a token; npm is upgraded first because Node 20's npm 10 cannot do trusted publishing. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
Summary
The SDK could only be installed from git because there was no release workflow, even though package.json already declares its published files (dist, README.md, LICENSE). This PR adds a release workflow triggered on
v*tags that checks the tag against the package version, runs checks and the build, publishes to npm with provenance, and creates a GitHub release. It also documents the process in CONTRIBUTING.md.Closes #3
Validation
Both runs are real GitHub Actions runs of this workflow, not a local replay.
actwas not usable from my environment (the Docker socket is not accessible), so I added a rehearsal entry point instead: a manual run executes every step except the upload and the release, which are gated ongithub.event_name == 'push'. A branch cannot publish.v0.1.0— success: https://github.com/nonchalanttee22-lgtm/keygate-client/actions/runs/41603043328Steps, in order: install from the lockfile,
Tag matches package.json,pnpm check,pnpm build, npm upgrade,npm publish --dry-runplus tarball assertions.Publish to npmshows as skipped because this was a manual run, and the release job is skipped for the same reason.v0.2.0— failure, as required: https://github.com/nonchalanttee22-lgtm/keygate-client/actions/runs/41603251363Check,Build, the npm upgrade, the tarball check andPublish to npmare all skipped after the guard fails.npm name
keygate-clientis free:npm view keygate-clientreturnsE404 Not Found - GET https://registry.npmjs.org/keygate-client. No scoped name is needed andpackage.jsonis unchanged.What changed
.github/workflows/release.yml (new)
v*, plusworkflow_dispatchwith ataginput for rehearsal (upload and release are skipped on manual runs).publishjob:contents: readandid-token: write; the separatereleasejob getscontents: write, so the step that publishes to npm never holds write access.corepack enable, thenpnpm install --frozen-lockfile.v+ the version in package.json, beforecheck,buildor any publish step.pnpm check, thenpnpm build, thennpm publish --dry-run+npm pack --dry-runassertions thatdist/index.js,dist/index.d.ts,LICENSEandREADME.mdship.^11.5.1before publishing: Node 20 bundles npm 10, and npm's OIDC/trusted publishing needs 11.5.1 or later.npm publish --provenance --access public.NPM_TOKENsecret (passed asNODE_AUTH_TOKEN), or npm trusted publishing when the maintainer configures it and leaves the secret unset.repository.urlin package.json to match the repository running the workflow (case-sensitively). It does:git+https://github.com/TeethakingBuilds/keygate-client.git. Releases must therefore run upstream; a fork publishing the same name would be rejected with E422.CONTRIBUTING.md
How to verify
Contents: read(visible near the top of the failing run's log).Checklist