ci: fix Release pipeline so merges publish to npm; idempotent GH Packages - #3
Conversation
…ages The Release workflow has been failing on every push to master and npm has been stuck at 0.4.0 since March. Two bugs: 1. npm never publishes on PR merges. release-it-action gates on should-semantic-release, which returns false for "Merge pull request #N" HEAD commits. This repo merges PRs with merge commits, so a release was never triggered. Replace the action with a direct `bunx release-it --ci` call -- conventional-changelog reads the full commit range since the last tag and computes the bump regardless of merge strategy. A job-level `if` skips release-it's own "chore: release vX" commit to prevent a re-trigger loop (the guard the action used to provide). Also adds workflow_dispatch for manual releases. 2. The job crashed every run at "Publish to GitHub Packages": `npm error You cannot publish over the previously published versions`. The step always re-published the current version. Make it idempotent: skip if the version already exists on GitHub Packages. Supporting changes: - .release-it.json: requireCommitsFail=false so no-op pushes skip cleanly instead of failing the job. - cspell.json: allow "inlines" and "pyproject" (from src/utils/local-content.ts) to fix the Lint Spelling check.
|
👋 Hi @WomB0ComB0, thanks for the pull request! A scan flagged some concerns with it. Could you please take a look? [pr-linked-issue] This pull request is not linked as closing any issues. This repository keeps to GitHub issues for discussing potential changes. Most or all changes should be marked as approved in an issue before a pull request is sent to resolve them. To resolve this report:
[pr-task-completion] This PR's body is missing
Repositories often provide a set of tasks that pull request authors are expected to complete. Those tasks should be marked as completed with a
|
Problem
The
Releaseworkflow has failed on every push tomaster, and npm has been frozen at0.4.0since March 17. Two independent bugs:1. npm never publishes on PR merges
The job used
JoshuaKGoldberg/release-it-action, which gates onshould-semantic-release. That tool returnsfalsefor"Merge pull request #N"HEAD commits — and this repo merges PRs with merge commits:So
release-itnever ran → nothing reached npmjs.2. The job crashed every run on GitHub Packages
The "Publish to GitHub Packages" step always re-published the current version.
0.4.1was cut to GitHub Packages once (but never to npmjs), so the step has hard-failed ever since.Fix
release-itdirectly (bunx release-it --ci) instead ofrelease-it-action. Its conventional-changelog plugin reads the full commit range since the last tag and computes the bump regardless of merge strategy, so normal PR merges now release.ifskips the run triggered by release-it's ownchore: release vXcommit — replacing the re-trigger guard the action used to provide (no release loop).workflow_dispatchadded for manual releases..release-it.json:requireCommitsFail: false→ no-op pushes skip cleanly.cspell.json: allowinlines/pyproject→ fixes the red Lint Spelling check.Before merging — two prerequisites
NPM_TOKENsecret must be a valid npm automation token. This is what the pipeline publishes with; it has been untested since the gate blockedrelease-itentirely. If it is stale, the npm publish will fail.0.4.1git tag needs to exist on the repo (it does not today — only0.2.0/0.3.0/0.4.0). The commit0aa90ceis literallychore: release v0.4.1, so tagging it reconciles history and makes the next release compute to0.4.2(not a duplicate0.4.1). (Being pushed alongside this PR.)On merge
release-itcomputes a patch bump from thefix:commits since0.4.1→ cuts0.4.2: updatesCHANGELOG.md, tags0.4.2, creates the GitHub release, and publishes to both npmjs and GitHub Packages. That ships the security fixes (PR #1) + the vitest bump (PR #2) to the public registry.Validation (local)
bun run lint:spelling→ 0 issues.release-it.json+cspell.jsonvalid JSON;release.ymlvalid YAML (triggerspush+workflow_dispatch,ifguard parses, 8 steps)release-it --dry-runreaches the publish step (only stops on local npm auth, as expected)