Skip to content

Release: publish only the npm versions that are missing - #187

Merged
renezander030 merged 1 commit into
masterfrom
npm-publish-skip-published
Nov 24, 2026
Merged

renezander030 merged 1 commit into
masterfrom
npm-publish-skip-published

Conversation

@renezander030

Copy link
Copy Markdown
Owner

The release workflow's npm publish step now publishes only the package versions npm does not have yet.

  • .github/scripts/npm-publish-new.mjs reads each public package's version from the registry: a missing version is published with provenance; a version npm already serves with the same contents (the same npm pack integrity) is skipped and listed in already-published.json; a version npm serves with other contents fails the run with its name.
  • So a release run that stopped half way, or a re-run of the same tag, finishes instead of failing on npm's "cannot publish over the previously published version".
  • Publishing still uses npm trusted publishing (OIDC, id-token: write) with NPM_CONFIG_PROVENANCE; no npm token is stored.
  • A manual run of the workflow (workflow_dispatch) now runs only the new npm-trust-proof job: it exchanges the job's OIDC token with npm and says whether npm would take the publish, publishing nothing. The portable-native and release jobs run only on a tag push.

This is a merge only: no version change, no tag.

Evidence

  • The publish script's cases pass in its own test suite (5 of 5): first publish of every package, an unbumped package and a retry skipped when npm has the same contents, other contents failing with the name, an unreadable registry and a refused publish both named, the skip list written.
  • npm pack integrity reproduces npm's dist.integrity on two real releases (foundations-cli 0.2.1 from its tag; @reneza/skillgate 0.16.1 after npm ci and its build), so a retry recognises what is already published.
  • release.yml parses as YAML; both scripts pass node --check; the checks below run on this branch.

Door

Two-way: revert this commit; nothing runs until the next release tag or a manual run.

Blast radius

.github/workflows/release.yml and .github/scripts/ only; the next tagged release's npm publish step. No package code, no CI workflow, no version.

The publish step now publishes each package version npm does not have yet and skips
a version npm already serves with the same contents, so a release run that stopped
half way can simply run again. A version npm serves with other contents fails the run
with its name. Publishing keeps provenance through npm trusted publishing (OIDC), with
no npm token in the repository.

A manual run of the workflow now proves npm's trusted-publisher login without
publishing anything (npm-trust-proof job); the release jobs run only on a tag.
@renezander030
renezander030 merged commit cc6367d into master Nov 24, 2026
17 checks passed
@renezander030
renezander030 deleted the npm-publish-skip-published branch November 24, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant