Skip to content
Widget Library

Releasing

How a merge to development becomes a version on npm, and how this documentation is deployed.

This page explains how the package is released to npm and how this documentation site is deployed.


Every merge to development starts the Release workflow (.github/workflows/release.yml).

  1. Install dependencies.
  2. Run pnpm check: type check, lint and all tests, in happy-dom and in Chrome.
  3. Run pnpm build.
  4. Run semantic-release, which:
    • reads the commit messages since the last release tag and decides the next version,
    • writes CHANGELOG.md and the version in package.json,
    • publishes @segmentify/widgets to npm,
    • creates the Git tag (v1.2.3) and the GitHub release,
    • commits the changelog and version back to development with [skip ci].

If the checks fail, nothing is published. If no commit calls for a release, nothing is published either.


After a release, the workflow posts a card to a Microsoft Teams channel: the package name, the new version, the last ten versions with their dates, and links to npm and to the GitHub release. A run that publishes nothing posts nothing.

The channel’s webhook address is the NPM_TEAMS_WEBHOOK_URL secret. If the secret is missing or Teams refuses the message, the run shows a warning and still passes, because the version is already on npm.


The version follows Conventional Commits.

Commit message Release
fix: ..., perf: ... Patch: 1.2.3 → 1.2.4
feat: ... Minor: 1.2.3 → 1.3.0
feat!: ... or a BREAKING CHANGE: footer Major: 1.2.3 → 2.0.0
docs:, test:, chore:, ci:, refactor:, style:, build: No release

With squash merges the pull request title becomes the commit message. The PR Title Check workflow refuses a title that is not a Conventional Commit, because a wrong title means a wrong version or no release at all.


There is no npm token in this repository. The workflow proves its identity to npm with a short-lived OIDC token issued by GitHub, and npm publishes only if the request comes from the workflow it was told to trust.

npm can only trust a workflow for a package that already exists. A brand-new package therefore needs one manual publish before the workflow can take over. See First Publish below.

After that, the trusted publisher is configured once on npmjs.com, in the settings of the @segmentify/widgets package:

Setting Value
Publisher GitHub Actions
Organization or user segmentify-frontend
Repository widget-library
Workflow filename release.yml
Environment leave empty

Things that must stay true for it to keep working:

  • The workflow file is named release.yml. Renaming it breaks publishing until npm is updated.
  • The job has the permission id-token: write.
  • The job runs on a GitHub-hosted runner. Trusted publishing does not work on self-hosted runners, so this job did not move to job-runner-02 with the checks. It needs the organization’s GitHub Actions billing to be in order: when GitHub refuses hosted jobs, a merge is not released until the run is started again.
  • The job runs on Node.js 26. semantic-release 26 refuses older versions; the library itself still supports Node.js 20 and newer.
  • repository.url in package.json points at this repository.

This is done once, by a person with publish rights in the @segmentify organisation on npm, from their own machine.

Terminal window
git checkout rewrite/contract-v1 # or development, once it is merged
pnpm install
pnpm check
pnpm build
npm login
npm publish --access restricted

This publishes the version in package.json (0.3.0) and creates the package. Then:

  1. Open the package’s settings on npmjs.com and add the trusted publisher with the values above.
  2. Merge to development. From here on the Release workflow publishes every version, and nobody publishes by hand again.

--access restricted makes the package private to the organisation, like @segmentify/integration. Use --access public instead only if the package is meant to be public.


The Vercel project of this repository deploys this documentation and nothing else. Its root directory is docs/, so Vercel installs and builds only that folder. A commit that changes nothing under docs/ is not deployed.

A push to development updates the live site; every other branch and pull request gets a preview deployment. The settings are listed in docs/README.md.

The site is protected by Vercel Authentication and is only readable by the team.

The library itself is never deployed to Vercel. It reaches customers through npm and @segmentify/integration.