semantic-deployment-in-2027 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,10 +71,19 @@ Every version of it after the first was released by the workflows in [.github/wo
|
|
|
71
71
|
|
|
72
72
|
🐢🚀 This guide caters to a Node.js crowd, but release-please supports [dozens of languages](https://github.com/googleapis/release-please#strategy-language-types-supported), and PyPI, RubyGems, and crates.io all have their own version of trusted publishing.
|
|
73
73
|
|
|
74
|
-
1. Configure your repo to only allow squash merging, and set
|
|
74
|
+
1. Configure your repo to only allow squash merging, and set the default commit message to _Pull request title_ (Settings > General > Pull Requests). Pick that exact option. The other ones put the PR description or the individual commit messages into the squash commit, and release-please reads those too. See the gotchas below for how I learned this.
|
|
75
75
|
1. In Settings > Actions > General, leave the default workflow permissions set to read-only, and check _Allow GitHub Actions to create and approve pull requests_ so release-please can open its Release PR.
|
|
76
|
+
|
|
77
|
+
If you'd rather do both of those steps from the command line:
|
|
78
|
+
```sh
|
|
79
|
+
gh api -X PATCH repos/your-name/your-repo \
|
|
80
|
+
-F allow_squash_merge=true -F allow_merge_commit=false -F allow_rebase_merge=false \
|
|
81
|
+
-f squash_merge_commit_title=PR_TITLE -f squash_merge_commit_message=BLANK
|
|
82
|
+
gh api -X PUT repos/your-name/your-repo/actions/permissions/workflow \
|
|
83
|
+
-f default_workflow_permissions=read -F can_approve_pull_request_reviews=true
|
|
84
|
+
```
|
|
76
85
|
1. Add a [release.yml](.github/workflows/release.yml) workflow and a [semantic-pull-request.yml](.github/workflows/semantic-pull-request.yml) workflow.
|
|
77
|
-
1. If the package has never been published, publish the first version by hand with `npm
|
|
86
|
+
1. If the package has never been published, publish the first version by hand with `npm publish`, then create a matching GitHub release (like `v0.1.0`) so release-please knows where to start counting from. npm won't let you configure trusted publishing for a package that doesn't exist yet. Run the publish from a real terminal: if you sign in to npm with a passkey, npm opens a browser window for it, and in a non-interactive shell it just fails with `EOTP`.
|
|
78
87
|
1. Tell npm to trust your release workflow. You can do it on the package's settings page on npmjs.com, or from the command line with npm 11.15 or newer:
|
|
79
88
|
```sh
|
|
80
89
|
npx npm@latest trust github your-package --repo your-name/your-repo --file release.yml --allow-publish
|
|
@@ -92,6 +101,9 @@ Optional hardening:
|
|
|
92
101
|
- Educating contributors: this may still be the hardest part. Some people have never used semantic prefixes before, so they may be surprised when they open a pull request and see a failing check. You can edit the title of a PR on their behalf to make it pass. Coding agents are good at following the convention if you tell them about it in your `AGENTS.md`.
|
|
93
102
|
- You still gotta push a few buttons: release-please accumulates changes in a Release PR, and it's up to you to decide when to merge it. That's a feature, but it means you have to remember to go merge it.
|
|
94
103
|
- CI on the Release PR needs a click: PRs opened with the built-in `GITHUB_TOKEN` [don't trigger workflows automatically](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow#triggering-a-workflow-from-a-workflow). GitHub now creates the runs in an approval-required state, so you'll see an _Approve workflows to run_ button on the Release PR. If you have required status checks and that gets old, pass a token from a GitHub App to release-please using [actions/create-github-app-token](https://github.com/actions/create-github-app-token).
|
|
104
|
+
- Approving CI runs from the command line: `gh api -X POST repos/your-name/your-repo/actions/runs/RUN_ID/approve` does the same thing as the button.
|
|
105
|
+
- PR descriptions can bump the major version: the first PR I merged into this repo was a `feat:`, and release-please proposed 1.0.0 instead of 0.2.0. The squash commit included the PR description, the description mentioned `BREAKING CHANGE:` in passing, and that was enough for release-please to treat it as a breaking change footer. Setting the squash commit message to _Pull request title_ prevents it. If it's already happened, edit the merged PR's description to add a `BEGIN_COMMIT_OVERRIDE` block with the message you meant ([docs](https://github.com/googleapis/release-please#how-can-i-fix-release-notes)), then re-run the Release workflow.
|
|
106
|
+
- New versions take a few minutes to show up: npm scans each version before making it installable, and it took about 7 minutes for the very first version of this package to appear, and about 2 minutes for the next one. For a brand new package, npm also puts up a `0.0.0-stage` placeholder version while that happens. Both are expected.
|
|
95
107
|
- Trusted publishing is tied to the workflow filename: if you rename `release.yml`, or move the publish step into a reusable workflow, npm will reject the publish until you update the trust configuration. It also only works on GitHub-hosted runners.
|
|
96
108
|
- Configure setup-node properly: you still need to set `registry-url` in the [setup-node](https://github.com/actions/setup-node) step of your release workflow, and you need Node 22.14 or newer with npm 11.5.1 or newer. This repo uses Node 26.
|
|
97
109
|
- Use `pull_request`, not `pull_request_target`, for the title check: it works for forks, and GitHub [blocks `pull_request_target` by default](https://github.com/amannn/action-semantic-pull-request#event-triggers) in public repos starting December 2, 2026.
|
package/index.js
CHANGED
|
@@ -7,7 +7,8 @@ const breakingFooter = /^BREAKING[ -]CHANGE: /m
|
|
|
7
7
|
export function bump (message) {
|
|
8
8
|
const match = header.exec(message)
|
|
9
9
|
if (!match) return null
|
|
10
|
-
const [,
|
|
10
|
+
const [, rawType, breaking] = match
|
|
11
|
+
const type = rawType.toLowerCase()
|
|
11
12
|
if (breaking || breakingFooter.test(message)) return 'major'
|
|
12
13
|
if (type === 'feat') return 'minor'
|
|
13
14
|
if (type === 'fix') return 'patch'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-deployment-in-2027",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Tells you which SemVer bump a Conventional Commit title implies. Also a working demo of semantic deployment with release-please and npm trusted publishing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./index.js",
|