semantic-deployment-in-2027 0.0.0-stage → 0.2.0

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/index.js +15 -0
  4. package/package.json +27 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zeke Sikelianos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # Semantic Deployment, 2027 Edition
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This is an opinionated workflow for automating away some of the tedium of releasing versioned software.
4
+
5
+ It combines [SemVer](https://semver.org), [Conventional Commits](https://www.conventionalcommits.org), [GitHub Actions](https://github.com/features/actions), [Release Please](https://github.com/googleapis/release-please), [Semantic Pull Request](https://github.com/amannn/action-semantic-pull-request), and [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
6
+
7
+ The idea is the same as it was in the [2024 edition](https://github.com/zeke/semantic-deployment-in-2024): add a bit of semantic information to each pull request as you write it, then let automation take care of writing changelogs, determining version numbers, and publishing release artifacts to registries like GitHub and npm.
8
+
9
+ What's different is the credentials. In 2024 the recipe told you to make a GitHub personal access token and an npm token and paste them into your repo's secrets. In 2027 you don't need either one.
10
+
11
+ ## Why?
12
+
13
+ I maintain [a lot of software packages](https://www.npmjs.com/~zeke). A lot of that maintenance is mindless work, so I always look for opportunities to automate away the mindless parts. When I worked on the [Electron](https://github.com/electron/electron) team at GitHub, we developed this semantic workflow to help manage the influx of community contributions to the project, and to remove the [human subjectivity](https://github.com/dominictarr/sentimental-versioning/blob/master/README.md) from the process of deciding how to version software.
14
+
15
+ And the stakes are higher now. Over the last couple of years, worms like Shai-Hulud have spread across npm by stealing long-lived tokens out of CI and using them to publish malware. npm and GitHub responded by revoking classic npm tokens, pushing everyone toward short-lived OIDC credentials, and adding a bunch of new guardrails. A release workflow you set up once and forget about should be built on the safe defaults.
16
+
17
+ ## The ideal workflow
18
+
19
+ The contribution process works like this:
20
+
21
+ 1. Contributors (and their coding agents) open pull requests, giving them titles with [semantic prefixes](https://www.conventionalcommits.org) like `fix:` and `feat:`.
22
+ 1. When you merge a pull request, it's automatically added to a long-running Release pull request that accumulates changes.
23
+ 1. When you're ready to cut a release, merge the Release pull request. A GitHub release is created and the package is published to npm.
24
+
25
+ That's it! You never think about version numbers again.
26
+
27
+ ## What changed since 2024
28
+
29
+ | 2024 | 2027 |
30
+ | -------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
31
+ | npm token stored as a repo secret | No npm token. Trusted publishing swaps a GitHub OIDC token for a short-lived publish token. |
32
+ | GitHub personal access token for release-please | The built-in `GITHUB_TOKEN`, or a GitHub App token if you want CI to run on Release PRs |
33
+ | Repo-wide "Read and write" workflow permissions | Read-only by default, with `permissions:` granted per job |
34
+ | npm provenance was opt-in | Provenance is automatic when you use trusted publishing |
35
+ | Actions referenced by moving tags like `@v4` | Actions locked to exact commits in `.github/workflows/actions.lock` |
36
+ | `google-github-actions/release-please-action@v4` | `googleapis/release-please-action@v5` |
37
+
38
+ The npm token change has a deadline. As of December 2025 classic npm tokens are [gone](https://github.blog/changelog/2025-12-09-npm-classic-tokens-revoked-session-based-auth-and-cli-token-management-now-available/), and granular tokens that bypass 2FA are [losing the ability to publish directly](https://github.blog/changelog/2026-07-08-npm-install-time-security-and-gat-bypass2fa-deprecation/) around January 2027. If you're still using the 2024 recipe, your next release is probably going to fail.
39
+
40
+ ## Tools
41
+
42
+ - [Semantic Versioning](https://semver.org) (aka SemVer), a methodology for applying version numbers to software.
43
+ - [Conventional Commits](https://www.conventionalcommits.org), a specification for adding human and machine readable meaning to commit messages.
44
+ - [GitHub Actions](https://github.com/features/actions), a GitHub feature for automating your work.
45
+ - [Release Please](https://github.com/googleapis/release-please), a tool that automates CHANGELOG generation, the creation of GitHub releases, and version bumps for your projects.
46
+ - [Semantic Pull Request](https://github.com/amannn/action-semantic-pull-request), a GitHub action that validates pull request titles have semantic prefixes.
47
+ - [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/), which lets a specific GitHub Actions workflow publish your package without a stored token.
48
+
49
+ All of these are still actively maintained as of December 2026. If release-please isn't your thing, [semantic-release](https://github.com/semantic-release/semantic-release) publishes on every merge instead of batching changes into a Release PR, and [Changesets](https://github.com/changesets/changesets) has contributors write little change files instead of relying on commit messages. It's popular for monorepos. Both support trusted publishing.
50
+
51
+ ## A working example
52
+
53
+ This repo is its own demo. It's a tiny npm package called [semantic-deployment-in-2027](https://www.npmjs.com/package/semantic-deployment-in-2027) that tells you which version bump a pull request title implies:
54
+
55
+ ```js
56
+ import { bump } from 'semantic-deployment-in-2027'
57
+
58
+ bump('feat: add a thing') // 'minor'
59
+ bump('fix(parser): oops') // 'patch'
60
+ bump('feat!: drop Node 20') // 'major'
61
+ bump('docs: fix typo') // null
62
+ ```
63
+
64
+ Every version of it after the first was released by the workflows in [.github/workflows](.github/workflows), so you can copy them and know they work:
65
+
66
+ - [release.yml](.github/workflows/release.yml) runs release-please on every push to `main`, then publishes to npm when a release is created.
67
+ - [semantic-pull-request.yml](.github/workflows/semantic-pull-request.yml) checks pull request titles.
68
+ - [ci.yml](.github/workflows/ci.yml) runs the tests.
69
+
70
+ ## Setting it up
71
+
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
+
74
+ 1. Configure your repo to only allow squash merging, and set _Pull request title_ as the default commit message. (Settings > General > Pull Requests)
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
+ 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 login` and `npm publish`. npm won't let you configure trusted publishing for a package that doesn't exist yet.
78
+ 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
+ ```sh
80
+ npx npm@latest trust github your-package --repo your-name/your-repo --file release.yml --allow-publish
81
+ ```
82
+ 1. Merge a `feat:` or `fix:` pull request, then merge the Release PR that shows up. Do it within 48 hours of the previous step, or npm will [expire the unused trust configuration](https://github.blog/changelog/2026-10-02-unvalidated-npm-trusted-publishing-configurations-now-expire/) and you'll have to create it again.
83
+
84
+ Optional hardening:
85
+
86
+ - Run `gh extension install github/gh-actions-lock` and then `gh actions-lock` to [lock every action your workflows use](https://docs.github.com/en/actions/concepts/security/workflow-dependency-lockfiles) to an exact commit. Commit the generated `.github/workflows/actions.lock`. Dependabot keeps it up to date.
87
+ - Turn on [immutable releases](https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases) so nobody can move a tag or swap out a release asset after the fact.
88
+ - If you want a human to sign off on every release, switch to [staged publishing](https://github.blog/changelog/2026-05-22-staged-publishing-and-new-install-time-controls-for-npm/): change `npm publish` to `npm stage publish`, use `--allow-stage-publish` instead of `--allow-publish` in the trust configuration, and approve each release with 2FA from npmjs.com or the CLI. That way a stolen CI credential can't publish anything on its own. It's not required, and this repo doesn't use it.
89
+
90
+ ## Gotchas
91
+
92
+ - 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
+ - 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
+ - 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).
95
+ - 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
+ - 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
+ - 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.
98
+
99
+ ## For agents
100
+
101
+ See [AGENTS.md](AGENTS.md).
package/index.js ADDED
@@ -0,0 +1,15 @@
1
+ const header = /^(\w+)(?:\([^)]*\))?(!)?: .+/
2
+ const breakingFooter = /^BREAKING[ -]CHANGE: /m
3
+
4
+ // Returns the SemVer bump implied by a Conventional Commit message:
5
+ // "major", "minor", "patch", or null if the message doesn't call for a release.
6
+ // Accepts a PR title or a full commit message with a body and footers.
7
+ export function bump (message) {
8
+ const match = header.exec(message)
9
+ if (!match) return null
10
+ const [, type, breaking] = match
11
+ if (breaking || breakingFooter.test(message)) return 'major'
12
+ if (type === 'feat') return 'minor'
13
+ if (type === 'fix') return 'patch'
14
+ return null
15
+ }
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "semantic-deployment-in-2027",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
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
+ "type": "module",
6
+ "exports": "./index.js",
7
+ "files": [
8
+ "index.js"
9
+ ],
10
+ "scripts": {
11
+ "test": "node --test"
12
+ },
13
+ "engines": {
14
+ "node": ">=22"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/zeke/semantic-deployment-in-2027.git"
19
+ },
20
+ "homepage": "https://github.com/zeke/semantic-deployment-in-2027#readme",
21
+ "keywords": [
22
+ "semver",
23
+ "conventional-commits",
24
+ "release-please",
25
+ "trusted-publishing"
26
+ ],
27
+ "author": "Zeke Sikelianos <zeke@sikelianos.com>",
28
+ "license": "MIT"
29
+ }