This repository publishes to npm via GitHub Actions when you push a tag like v1.2.3.
- Workflow file:
.github/workflows/npm-publish.yml - Trigger: push of a tag matching
v*.*.* - Publish command:
npm publish --provenance --access public
- Add a Trusted Publisher in your npm package settings.
- Select
GitHub Actionsas the provider and bind this repository and workflow (.github/workflows/npm-publish.yml). - No
NPM_TOKENGitHub secret is required.
# Example: release 0.1.0
npm version 0.1.0
git push origin main --follow-tags- The workflow runs
npm ci,npm run typecheck,npm test, andnpm run build. - If the Git tag (for example
v0.1.0) andpackage.jsonversion do not match, the workflow fails and does not publish.