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.
From Merge to npm
Section titled “From Merge to npm”Every merge to development starts the Release workflow (.github/workflows/release.yml).
- Install dependencies.
- Run
pnpm check: type check, lint and all tests, in happy-dom and in Chrome. - Run
pnpm build. - Run
semantic-release, which:- reads the commit messages since the last release tag and decides the next version,
- writes
CHANGELOG.mdand the version inpackage.json, - publishes
@segmentify/widgetsto npm, - creates the Git tag (
v1.2.3) and the GitHub release, - commits the changelog and version back to
developmentwith[skip ci].
If the checks fail, nothing is published. If no commit calls for a release, nothing is published either.
Teams Announcement
Section titled “Teams Announcement”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.
Which Version Comes Next
Section titled “Which Version Comes Next”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.
npm Authentication: Trusted Publishing
Section titled “npm Authentication: Trusted Publishing”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-02with 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-release26 refuses older versions; the library itself still supports Node.js 20 and newer. repository.urlinpackage.jsonpoints at this repository.
First Publish
Section titled “First Publish”This is done once, by a person with publish rights in the @segmentify organisation on npm, from their own machine.
git checkout rewrite/contract-v1 # or development, once it is mergedpnpm installpnpm checkpnpm buildnpm loginnpm publish --access restrictedThis publishes the version in package.json (0.3.0) and creates the package. Then:
- Open the package’s settings on npmjs.com and add the trusted publisher with the values above.
- 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.
Documentation Deployment
Section titled “Documentation Deployment”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.
Next Steps
Section titled “Next Steps”- Development explains how to prepare a change.
- Testing explains what
pnpm checkruns.