You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The flag asserts the detected mode rather than setting it, so the
name should reflect that. Reads more naturally in YAML where there's
no surrounding context.
Internal `assertMode` field name unchanged.
Add `--expect-mode` flag to `bumpy ci release` for asserting the detected release mode (`version-pr` or `publish`). Enables split-job release workflows where each job fails loudly if the runtime state doesn't match what the job expects. Refactored `ReleaseOptions` to rename the existing `mode` field to `autoPublish: boolean` and add `assertMode`. `--expect-mode` and `--auto-publish` cannot be combined.
|`--mode <mode>`| Assert detected mode: `version-pr` or `publish`. Errors if the detected mode differs. Use to gate split-job workflows so a job can't silently fall into the wrong path. |
237
-
|`--auto-publish`| Version + publish directly instead of creating a PR |
|`--expect-mode <mode>`| Assert detected mode: `version-pr` or `publish`. Errors if the detected mode differs. Use to gate split-job workflows so a job can't silently fall into the wrong path. |
237
+
|`--auto-publish`| Version + publish directly instead of creating a PR |
|`--branch <name>`| Version PR branch name (default: `bumpy/version-packages`) |
240
240
241
241
Requires `GH_TOKEN`. When `BUMPY_GH_TOKEN` is set, it is automatically used to push the version branch and create/edit the PR so that PR workflows trigger (see [GitHub Actions setup](github-actions.md#token-setup)).
Copy file name to clipboardExpand all lines: docs/github-actions.md
+16-8Lines changed: 16 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ jobs:
80
80
fetch-depth: 0
81
81
- uses: oven-sh/setup-bun@v2
82
82
- run: bun install
83
-
- run: bunx @varlock/bumpy ci release --mode version-pr
83
+
- run: bunx @varlock/bumpy ci release --expect-mode version-pr
84
84
env:
85
85
GH_TOKEN: ${{ github.token }}
86
86
BUMPY_GH_TOKEN: ${{ secrets.BUMPY_GH_TOKEN }} # so the version PR triggers CI
@@ -106,7 +106,7 @@ jobs:
106
106
- run: bun install
107
107
# Expensive build steps that only matter before publish go here:
108
108
# - run: bun run build
109
-
- run: bunx @varlock/bumpy ci release --mode publish
109
+
- run: bunx @varlock/bumpy ci release --expect-mode publish
110
110
env:
111
111
GH_TOKEN: ${{ github.token }}
112
112
BUMPY_GH_TOKEN: ${{ secrets.BUMPY_GH_TOKEN }} # so `release: published` workflows trigger
@@ -116,14 +116,22 @@ jobs:
116
116
117
117
- `plan` runs `bumpy ci plan` to determine whether the current push should update the Version Packages PR (`version-pr`), publish unpublished packages (`publish`), or do nothing.
118
118
- Only one of `version-pr` or `publish` runs per push. The other is skipped via the `if:` condition.
119
-
- The `--mode` flag on `ci release` asserts that the detected mode matches what each job expects — if the runtime state ever drifts, the job fails loudly instead of silently doing the wrong thing.
119
+
- The `--expect-mode` flag on `ci release` asserts that the detected mode matches what each job expects — if the runtime state ever drifts, the job fails loudly instead of silently doing the wrong thing.
120
120
- Expensive build steps (compilation, tests, bundling) only run inside the `publish` job, so PR merges that just maintain the version PR stay cheap.
121
121
122
-
### One-time setup
122
+
### Required setup
123
123
124
-
1. **Create the `publish` environment** in repo Settings → Environments. GitHub auto-creates it on the first run, but creating it manually lets you add protection rules (required reviewers, branch restrictions to `main` only) before any release runs.
125
-
2. **Pin the npm trusted publisher to environment `publish`** on each package's npmjs.com settings → Trusted Publishers → GitHub Actions. Set the environment field to `publish`. This binds the OIDC trust to that specific environment — even if someone adds a rogue workflow file, npm will reject any token request that doesn't carry the `publish` environment claim.
126
-
3. **Set `BUMPY_GH_TOKEN`** — see [Token setup](#token-setup) below.
124
+
1. **Pin the npm trusted publisher to environment `publish`** on each package's npmjs.com settings → Trusted Publishers → GitHub Actions. Set the environment field to `publish`. This binds the OIDC trust to that specific environment — even if someone adds a rogue workflow file, npm will reject any token request that doesn't carry the `publish` environment claim.
125
+
2. **Set `BUMPY_GH_TOKEN`** — see [Token setup](#token-setup) below.
126
+
127
+
That's it — the `publish` environment auto-creates on the first publish run, so no manual GitHub setup is required.
128
+
129
+
### Optional hardening: protection rules on the `publish` environment
130
+
131
+
If you create the environment manually in repo Settings → Environments _before_ the first publish, you can attach protection rules:
132
+
133
+
- **Restrict deployment branches to `main`** — recommended. Cheap defense in depth: non-`main` refs can never request an OIDC token from this environment, even if a workflow trigger is accidentally widened later.
134
+
- **Required reviewers** — optional. Adds a manual approval gate before each publish. Usually redundant if `npmStaged: true` is enabled (below), since you already have a 2FA approval gate on npmjs.com.
127
135
128
136
**Recommended publish config** — enable provenance and staged publishing for maximum security:
0 commit comments