This document summarizes the current CI checks and npm release workflow of the repository.
The repository includes a GitHub Actions CI workflow that runs on pull requests and pushes to master / main:
npm cinpm testnpm run typechecknpm run buildnpm pack --dry-run
The repository includes three release-related workflows:
Release: manually triggered, readspackage.json.version, validates the target, then creates and pushes the matching tagDraft Release: triggered byv*tag pushes and automatically creates a GitHub draft releasePublish to npm: triggered by the GitHub Releasepublishedevent and publishes to the npm registry
Constraints:
- the tag must match the version in
package.json - the target commit must be reachable from the default branch history
- for example, if
package.json.version = 0.1.0-beta.0, the required tag isv0.1.0-beta.0
- update
package.json.versionto the target version and merge it into the default branch - open Actions → Release in the GitHub repository
- click Run workflow
- enter the release
ref(the current workflow default is hard-coded tomaster; enter the correct branch manually if the default branch changes) - the workflow automatically runs:
npm cinpm testnpm run typechecknpm run buildnpm pack --dry-run- create and push
v<package.json.version>
- after the tag is pushed, the
Draft Releaseworkflow automatically creates a draft release - open the repository Releases page and enter the newly created draft release
- click Publish release
- the
Publish to npmworkflow automatically runs:npm cinpm testnpm run typechecknpm run buildnpm pack --dry-run- choose the npm dist-tag from the version and run
npm publish
Before releasing, configure the NPM_TOKEN secret in GitHub (an npm automation token is recommended).
- stable versions such as
1.2.3are published tolatest - prerelease versions use the semver prerelease identifier as the dist-tag:
1.2.3-beta.0→beta1.2.3-rc.0→rc1.2.3-alpha.1→alpha
- the release workflow uses
npm publish --ignore-scriptsto avoid rerunning npm lifecycle scripts whileNPM_TOKENis present - publishing the same version twice will be rejected by npm, which is expected
Example:
# 1. update the version in package.json
# 2. commit the version change
git add package.json package-lock.json
git commit -m "chore: prepare release v0.1.0-beta.0"
git push origin <default-branch>
# 3. create and push the tag
git tag v0.1.0-beta.0
git push origin v0.1.0-beta.0Whether you trigger release from the GitHub UI or push the tag manually, the tag push will automatically create a draft release through GitHub Actions. The package is only published to npm after you click Publish release on GitHub.