Repository navigation
ci: publish npm releases on version changes #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+175
−5
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
426a09c
ci: publish npm releases from version change PRs
fengmk2 bda8899
ci: avoid repeating PR checks during release
fengmk2 6dfb0cd
ci: trigger releases directly from version changes
fengmk2 9603d84
ci: preserve queued releases and protect latest tag
fengmk2 c09a78e
ci: use major version tags for GitHub actions
fengmk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Releasing | ||
|
|
||
| Maintainers choose the release version in a pull request. Commit messages do not | ||
| trigger automatic version bumps or npm releases. | ||
|
|
||
| 1. Create a branch from `master`. | ||
| 2. Update `package.json` with `npm version patch --no-git-tag-version`, or choose | ||
| the required minor, major, or explicit version. | ||
| 3. Add the release notes to `CHANGELOG.md` and open a PR into `master`. | ||
| 4. Merge the PR after its CI checks pass. | ||
|
|
||
| The `Release` workflow compares the package versions before and after the push | ||
| to `master` and publishes when the version changes. Dependency-only changes do | ||
| not publish a package. The workflow does not check whether the push came from a | ||
| PR; branch protection can enforce that repository policy. | ||
|
|
||
| The workflow checks out the exact pushed commit and installs dependencies. | ||
| `npm publish` runs the `prepublishOnly` script to build the package. The release | ||
| workflow relies on the PR's CI checks and does not run them again. It publishes | ||
| stable versions with the `latest` npm tag and prerelease versions with `next`. | ||
| It then creates a `v<version>` tag and a GitHub release with generated notes. | ||
| Release jobs run one at a time, with up to 100 pending jobs queued. | ||
|
|
||
| Stable releases use npm's default `latest` tag without an explicit `--tag` option. | ||
| If a newer stable version is already published, npm rejects an older unpublished | ||
| version instead of moving `latest` backward. This also applies when retrying an | ||
| older release job. | ||
|
|
||
| If a release fails, rerun its failed jobs in GitHub Actions. The workflow skips | ||
| versions that already exist on npm and GitHub releases that already exist, so a | ||
| retry can finish creating the GitHub release without publishing the package again. | ||
|
|
||
| ## npm trusted publisher | ||
|
|
||
| Configure the `utility` package's trusted publisher on npm with: | ||
|
|
||
| - Organization: `node-modules` | ||
| - Repository: `utility` | ||
| - Workflow filename: `release.yml` | ||
| - Environment: leave empty | ||
| - Allowed action: `npm publish` | ||
|
|
||
| The workflow uses Node.js 24, npm 11, and `id-token: write` for OIDC authentication. | ||
| It does not use an npm token or the `GIT_TOKEN` secret. GitHub release creation | ||
| uses the repository's built-in `GITHUB_TOKEN`. | ||
|
|
||
| See the [npm trusted publishing documentation](https://docs.npmjs.com/trusted-publishers/) | ||
| for the package settings. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.