Skip to content

Commit a2ce7cd

Browse files
author
Kevin Arthur
committed
fix(release): publish job is double-gated — explicit dispatch input + environment
Previously the publish job auto-ran when the draft finished unless the release-publish environment happened to have a required reviewer configured — a settings-dependent gate that is decorative when unconfigured. Now: 1. publish only runs on workflow_dispatch with publish=yes (tag pushes always stop at a draft) 2. the release-publish environment (created in repo settings) still requires its reviewer as an independent second checkpoint Publish command: gh workflow run release.yml -f tag=v0.1.0 -f publish=yes
1 parent 233a6e5 commit a2ce7cd

2 files changed

Lines changed: 34 additions & 12 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ on:
3636
default: 'linux'
3737
type: choice
3838
options: [linux, linux-windows, all]
39+
publish:
40+
description: 'Explicitly publish the existing draft for this tag (never auto-runs)'
41+
required: false
42+
default: 'no'
43+
type: choice
44+
options: [no, yes]
3945

4046
concurrency:
4147
# Never cancel a release build in flight — a half-uploaded draft is worse than
@@ -681,15 +687,19 @@ jobs:
681687
echo "Smoke-test the artifacts, then run the \`publish\` job to make it public."
682688
} >> "$GITHUB_STEP_SUMMARY"
683689
684-
# ── 5. Publish — gated on a human ───────────────────────────────────────────
690+
# ── 5. Publish — double-gated on a human ────────────────────────────────────
691+
# Two independent gates, so a misconfiguration of either cannot publish:
692+
# 1. This job only runs on an explicit workflow_dispatch with publish=yes.
693+
# A tag push builds a draft and stops; nothing auto-publishes.
694+
# 2. The `release-publish` environment must have a required reviewer in
695+
# repo settings (Settings → Environments → release-publish → Required
696+
# reviewers). See docs/release/ci-secrets.md.
685697
publish:
686698
name: Publish (manual approval)
687-
needs: [preflight, draft]
699+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'yes'
700+
needs: [preflight]
688701
runs-on: ubuntu-latest
689702
timeout-minutes: 10
690-
# The `release-publish` environment must have required reviewers configured
691-
# in repo settings. Without that, this job runs automatically and the gate is
692-
# decorative. See docs/release/ci-secrets.md.
693703
environment:
694704
name: release-publish
695705
permissions:

‎docs/release/ci-secrets.md‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,27 @@ The top-level default is `contents: read`; jobs escalate individually.
105105

106106
`release.yml`'s `publish` job declares `environment: release-publish`.
107107

108-
**This does nothing until it is configured.** An environment with no protection
109-
rules does not pause — the job runs immediately and the "manual approval" is
110-
decorative.
108+
**Two gates protect publication, and neither depends on the other:**
111109

112-
To make it real: **Settings → Environments → New environment → `release-publish`**,
113-
then enable **Required reviewers** and add yourself. Optionally restrict
114-
deployment branches to tags matching `v*`.
110+
1. **Explicit dispatch input.** The publish job only runs on a manual
111+
`workflow_dispatch` with `publish=yes`. A tag push always stops at a draft;
112+
nothing in the pipeline auto-publishes, even if the environment below is
113+
unconfigured.
114+
2. **Environment approval.** Settings → Environments → `release-publish` →
115+
enable **Required reviewers** and add yourself. This is the second,
116+
independent human checkpoint (the owner UI step — the REST API returns 404
117+
for this rule type with a repo-scoped token).
115118

116-
- [ ] Create the `release-publish` environment
119+
The exact publish command:
120+
121+
```sh
122+
gh workflow run release.yml --ref master \
123+
-f tag=v0.1.0 -f platforms=all -f publish=yes
124+
```
125+
126+
Checklist (repo settings):
127+
128+
- [x] Create the `release-publish` environment
117129
- [ ] Add at least one required reviewer
118130
- [ ] Verify by running a release and confirming the workflow waits
119131

0 commit comments

Comments
 (0)