ci: fix GitHub Packages publish 401 so v4.2.1 actually publishes#28
Merged
Merged
Conversation
The publish job failed on every push to main with: npm error code E401 npm error 401 Unauthorized - PUT https://npm.pkg.github.com/@w3spi5%2fcodepack unauthenticated: User cannot be authenticated with the token provided. The 4.2.1 tarball builds fine; only authentication fails, which is why no release after v4.2 was ever published to GitHub Packages. - Publish with the auto-provisioned GITHUB_TOKEN (the job already grants packages: write) instead of the broken/missing NPM_TOKEN secret - Normalize the repository URL to git+https so GitHub Packages can link the package to this repository for token-based auth - Bump the workflow Node.js version 20 -> 22 (Node 20 is deprecated on runners) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2XJw3TXS1EuWdgmnGD4ts
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.
Context
Follow-up to #27. After #27 merged, the
Test & Publishworkflow ran onmainand thepublishjob failed — as it had on every push tomainsince v4.2. The tests pass; only publishing fails:The 4.2.1 tarball builds correctly — the package was never published purely because the
NPM_TOKENsecret used for authentication is missing/expired/lackingwrite:packagesscope. This is the real reason no working release exists on GitHub Packages after v4.2, independent of the content-extraction regression fixed in #27.What this PR does
GITHUB_TOKENinstead ofNPM_TOKEN. Thepublishjob already declarespermissions: packages: write, so the auto-provisionedGITHUB_TOKENcan publish this repo's scoped package to GitHub Packages — no manually-managed secret required.repositoryURL inpackage.jsonfrom the deprecatedgit://togit+https://so GitHub Packages reliably links the package to this repository for token-based auth.20→22(Node 20 is deprecated on GitHub Actions runners).No change to the package contents or to
codepack.shbehaviour —4.2.1(already onmain) stays the version being published, and it has not been published yet, so there is no version conflict.Verification
package.jsonparses as valid JSON;publish.ymlparses as valid YAMLmain, thepublishjob should authenticate viaGITHUB_TOKENand publish@w3spi5/codepack@4.2.1to GitHub Packagestestjob is unaffected and continues to pass🤖 Generated with Claude Code
Generated by Claude Code