ci: verify the tarball and release tag before publishing - #57
Open
macieju-opera wants to merge 1 commit into
Open
ci: verify the tarball and release tag before publishing#57macieju-opera wants to merge 1 commit into
macieju-opera wants to merge 1 commit into
Conversation
`npm publish` cannot be undone, and nothing checked what it was about to push. The check that was meant to do this never ran and never worked: - `pre-release.yml` triggered on `release-please-*` branches, and release-please was removed in d500b24, so only `workflow_dispatch` reached it. A separate workflow could not have gated the publish anyway. - `verify-npm-package.js` read `data['chrome-devtools-mcp']`, the upstream package name. `npm publish --json` is not keyed by package name either, so it exited 1 on every run. The check now runs inside `publish-to-npm-on-tag.yml` between the bundle and the publish, reads `npm pack` so it needs no registry or auth, derives the entry points from `package.json` `bin`, and fails when the tag does not name the packed version — which nothing caught in the manual bump-and-tag flow.
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.
npm publishis irreversible — a version published from a broken tarball can only be abandoned. Nothing checked what it was about to push.Why the existing check never helped
pre-release.ymlnever ran. It triggers onrelease-please-*branches; release-please was removed ind500b24. Onlyworkflow_dispatchreached it. And being a separate workflow, it could not have blockednpm publisheven if it had run.verify-npm-package.jsnever worked. It read:Two bugs: that is the upstream package name, and
npm publish --jsonis not keyed by package name at all — it is flat (name,files,entryCount, …). Every invocation threw and exited 1, caught by the try/catch asfailed to parse npm publish output.0.4.2 shipped a correct tarball by luck, not verification.
What this does
Moves the check into
publish-to-npm-on-tag.yml, betweennpm run bundleandnpm publish, where it can actually stop a bad release. The script now:npm pack --dry-run --jsoninstead ofnpm publish --dry-run— no registry, no auth, and no failure once the version exists, so it cannot spuriously block a releasepackage.jsonbinrather than hardcoding, so a renamed binary cannot ship missingRELEASE_TAGdoes not name the packed versionThat last check is new and covers a real gap: nothing stopped someone tagging
v0.4.3whilepackage.jsonsaid0.4.2.pre-release.ymlis deleted, and listed in the rename-or-delete table so the guard added in #55 keeps it from reappearing on an intake.Verified
contains all 4 required entry point(s) of 339 packed— exit 0RELEASE_TAG=…v0.4.2tag … matches opera-devtools-mcp@0.4.2— exit 0RELEASE_TAG=…v0.4.3tag … does not name the version being published— exit 1build/src/index.jsremovedtarball is missing 1 required file(s)— exit 1pre-release.ymlrestoredExit codes checked directly, not through a pipe — a check that prints an error but exits 0 would not fail CI.