Skip to content

Split-job release workflow + --mode assertion flag#91

Open
theoephraim wants to merge 1 commit into
mainfrom
ci/split-jobs-mode-flag
Open

Split-job release workflow + --mode assertion flag#91
theoephraim wants to merge 1 commit into
mainfrom
ci/split-jobs-mode-flag

Conversation

@theoephraim
Copy link
Copy Markdown
Member

Summary

  • Adds --mode <version-pr|publish> to bumpy ci release for asserting the detected release mode (errors instead of silently smart-routing when the runtime state doesn't match what the job expects). Cannot be combined with --auto-publish.
  • Restructures the project's own release workflow into three jobs: a low-privilege plan job gating a version-pr job (PR-write creds only) and a publish job (environment: publish, id-token: write for npm trusted publishing).
  • Rewrites docs/github-actions.md to lead with the split-job workflow + one-time setup (publish environment, OIDC pinning, BUMPY_GH_TOKEN). The single-job version is kept as a simplified alternative.

Why

Without a split, every push to main runs a job with id-token: write (or NPM_TOKEN in env) — even when the workflow is only updating the Version Packages PR. The split scopes those credentials to the publish job only and lets the npm trusted publisher be pinned to a specific GitHub Environment so rogue workflow files in the repo can't request a valid OIDC token.

The --mode flag turns the split's implicit if: gate into an explicit runtime assertion: if the publish job somehow runs while bump files are still present (a race, weird merge, or someone manually re-triggers it), it fails fast instead of silently falling into the version-pr code path.

Notable internals

  • ReleaseOptions.mode: 'auto-publish' | 'version-pr' renamed to autoPublish: boolean — cleaner CLI-flag-to-internal mapping. The only caller is packages/bumpy/src/cli.ts.
  • ciReleaseCommand now computes detectedMode once and consolidates the two near-identical "fall through to publish" branches.
  • Auto-publish mode flagged as not recommended in the docs (loses the review step + can't compose with the split-job pattern).

Test plan

  • bun run check — typecheck + format clean
  • bun run test — 225 tests pass
  • Manual: confirm the new release workflow runs end-to-end on the next merge to main (will exercise the planversion-pr path here, since this PR itself ships with a bump file)
  • After merge: create the publish environment in repo settings + pin the npm trusted publisher to it before the next publish run

🤖 Generated with Claude Code

Add a `--mode <version-pr|publish>` flag to `bumpy ci release` so each
job in a split-job release workflow can assert its expected runtime
state and fail loudly on drift instead of silently routing.

Updates the project's own release.yaml to use the recommended pattern:
a `plan` job (no write perms) gates a `version-pr` job (PR-only creds)
and a `publish` job (scoped to a new `publish` GitHub Environment with
id-token: write), so npm trusted-publisher OIDC can be pinned to the
environment and NPM_TOKEN exposure can be scoped via env secrets.

Internal: ReleaseOptions field `mode: 'auto-publish' | 'version-pr'`
renamed to `autoPublish: boolean` for clarity; new `assertMode` field
carries the assertion. `--mode` + `--auto-publish` together is
rejected at the CLI level.

Docs: github-actions.md restructured to lead with the split-job
workflow + environment setup, with the single-job version kept as a
simplified alternative. Auto-publish flagged as not recommended.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

bumpy-frog

The changes in this PR will be included in the next version bump.

minor Minor releases

  • @varlock/bumpy 1.10.2 → 1.11.0

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant