Skip to content

ci: publish to npm on merge into main - #27

Open
bcostaaa01 wants to merge 3 commits into
mainfrom
ci/npm-publish
Open

bcostaaa01 wants to merge 3 commits into
mainfrom
ci/npm-publish

Conversation

@bcostaaa01

@bcostaaa01 bcostaaa01 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • ci.yml: runs npm run ci (lint, typecheck, tests, DOM tests, build, smoke) on every pull request, on Node 20 and 24. Node 18 is left out because jsdom 29 needs Node 20 or newer.
  • release.yml: on every push to main, checks whether the version in package.json is already on npm.
    • If it is, nothing happens. Docs or refactor merges without a version bump publish nothing.
    • If it is not, it checks that CHANGELOG.md has a section for it, runs the CI workflow, publishes to npm and creates the vX.Y.Z tag plus a GitHub release with that changelog section as the notes.
    • A prerelease version (e.g. 1.0.0-beta.1) goes to the next dist-tag and is marked as a prerelease on GitHub.
  • scripts/release-notes.mjs: prints the CHANGELOG.md section of a version, with an emoji on each heading (✨ Added, 🔧 Changed, 🐛 Fixed, ...), plus a link to the version on npm and its install command. It fails when the section is missing or empty.

The release flow stays as it is: bump the version and add the changelog section in a chore(release): x.y.z PR, then merge it.

Before merging: npm trusted publisher

Publishing uses npm trusted publishing (OIDC), so there is no NPM_TOKEN secret. An owner of the stickyflow package on npmjs.com has to add the trusted publisher once:

  1. npmjs.com → package stickyflow → Settings → Trusted Publisher → GitHub Actions
  2. Organization or user: Stickyflow
  3. Repository: stickyflow.js
  4. Workflow filename: release.yml
  5. Environment: leave empty

Merging this PR on its own publishes nothing, because 0.5.0 is already on npm. The first publish happens with the next version bump.

The release workflow checks whether the version in package.json is
already on npm. If not, it runs the CI workflow, publishes with npm
trusted publishing (OIDC, with provenance) and creates the vX.Y.Z tag
and GitHub release, using the matching CHANGELOG.md section as the
release notes. Merges without a version bump publish nothing.
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