Publish to GitHub Packages and keep publishing to npm - #1150
Closed
unblee wants to merge 2 commits into
Closed
Conversation
Co-Authored-By: takahashikosuke <takohashi0410@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
unblee
marked this pull request as ready for review
September 8, 2026 05:03
The second setup-node only needs to write the auth line, so it inherits the Node set up by the first one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
|
Closing in favour of a different approach, together with its base #1149. Scoping the package names in the tree breaks the consumers, so the rename is dropped and the manifests are scoped inside the release workflow instead, right before the publish to GitHub Packages. Only With the rename gone, the npm side no longer has to be moved into a second job either: the existing See #1149 for the reasoning. The branch is left in place. |
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.
WHY
Releases to npm are currently published with a granular access token.
That token has to be rotated every 90 days, and the release stops once it expires.
Moving the publish target to GitHub Packages removes the problem.
Consumers still reference the old names on npm, so publishing to npm continues during the migration period.
This PR touches only
.github/workflows/release.yml.The package rename and the references that follow it live in the base PR.
WHAT
The release job is split in two.
create-release-pr(publish to GitHub Packages)actions/setup-nodeagain withregistry-url: https://npm.pkg.github.comandscope: "@wantedly", then publishes throughchangesets/actionGITHUB_TOKENthat Actions issues per job. This repository hasdefault_workflow_permissions: write, sopackages: writeis granted as long as nopermissions:block is writtenoutputs.publishedto the job behind itrelease-to-npm(publish to npm)needs: create-release-prandif: needs.create-release-pr.outputs.published == 'true'grep -rl '@wantedly/' | xargs sed, rewrites the registry to npmjs withjq, and publishes withlerna publish from-packagepackage.json. Files such aspackages/frolint/lib/utils/prettier.jsrequire the scoped names, so restoring only the name inpackage.jsonwould ship a broken package to npmsecrets.NPM_TOKENWhat to look at in review
set -euo pipefailis there becausegrep -rlexits 1 when it matches nothing, which would otherwise let the whole pipe count as a success and publish scoped names to npm as a brand new package without restoring themgit commit --no-verifyis used because husky's pre-commit runs ESLint through lint-staged, and it always fails right after the scope has been stripped since the config files can no longer be resolvedpermissions:block is added. The repository default (default_workflow_permissions: write) grants the necessary scopes. Being explicit would takecontents: write,pull-requests: writeandpackages: write, but publish only runs on master and cannot be verified by a PR check, so missing one would only surface after the merge. Whether to be explicit is left to the reviewerMerge order
Merge the base PR (the rename) first.
If this PR lands first, publishing to GitHub Packages fails with the unscoped names, the
release-to-npmjob does not meetpublished == 'true'and is skipped, and the supply to npm that consumers still reference stops.Note
Publish only runs after a merge to master, so this job layout cannot be verified by a PR check.
The first release after the merge is the only real verification.