Skip to content

feat: add Tag release workflow wrapping the releaser - #31321

Closed
f0ssel wants to merge 13 commits into
mainfrom
f0ssel/releaser-tag-release-workflow
Closed

f0ssel wants to merge 13 commits into
mainfrom
f0ssel/releaser-tag-release-workflow

Conversation

@f0ssel

@f0ssel f0ssel commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Adds a Tag release workflow (.github/workflows/tag-release.yaml) that runs scripts/releaser unattended, so a release no longer needs an engineer to run ./scripts/release.sh locally and press Enter through each prompt.

The existing release flow is unchanged: ./scripts/release.sh behaves as before unless you pass one of the new flags, and manual release.yaml runs are checked as before. The release docs move to Tag release in #31459.

Releaser flags

  • --non-interactive answers every prompt with its default, the same as pressing Enter, and logs each answer. Safety checks that default to no (downgrade, duplicate version, skipped patch, tag already exists, version not matching the branch) fail the run with a descriptive error. A prompt with no default fails instead of waiting for input. This mode also requires gh to be logged in, so the open-PR and breaking-change checks can't be skipped without anyone noticing. GitHub lookups that only warn interactively (open PRs, and PR metadata for the breaking-change check and release notes) fail the run instead, as does a failure to open the docs PR.
  • --allow-open-prs continues when open PRs target the release branch.
  • --allow-breaking-changes continues when a patch release contains breaking changes.
  • --requested-by and --requested-by-run-url add Requested-by and Requested-via lines to the tag message. The first line stays Release vX.Y.Z.
  • --dry-run already existed and is passed through unchanged.

Prompt handling is consolidated in a prompter type in ui.go, with unit tests for the non-interactive behavior.

Workflow

Run it from the "Use workflow from" dropdown on a release/X.Y branch; any other ref fails the first step. Inputs: dry_run (defaults to true), allow_open_prs, and allow_breaking_changes. When a check fails, re-run with the matching override enabled. Release candidates are tagged on main, so they still use ./scripts/release.sh locally.

  • Runs the same maintainer/admin check as release.yaml.
  • Runs go run ./scripts/releaser from the release branch checkout, so the workflow and flags must exist on that branch.
  • Uses the release App token (RELEASE_APP_ID) to push the tag, trigger release.yaml, and open the docs PR, because that App is on the tag create protection bypass list.
  • Uploads the generated release notes as an artifact.

Change to release.yaml

Tag release triggers release.yaml with the release App token, so the run's actor is the App's bot, which isn't a maintainer, and the existing check-perms would reject it. check-perms now mints a read-only release App token to learn the App's slug, and lets the run through when the actor is exactly that App's bot. Tag release has already checked the human's maintainer/admin permission. Every other actor is checked as before. Nothing else in release.yaml changes.

release.yaml runs from the tag's ref, so this PR must be on the release branch (backported) before a Tag release there can publish.

Before merging

  • The release App needs actions: write to trigger release.yaml and pull-requests: write to open the docs PR. I could not verify its current permissions.

Testing

  • go test ./scripts/releaser, golangci-lint, actionlint, and zizmor pass.
  • Local --non-interactive --dry-run on main completed the RC flow through the simulated release.yaml trigger (before the workflow was limited to release branches).
  • On release/2.38, the run failed on 6 open PRs and suggested --allow-open-prs. With the flag, it completed through the simulated docs PR, and the simulated tag message included the Requested-by lines.
  • The --allow-breaking-changes path and the fail-on-lookup-error paths are not tested end to end.

Generated by Coder Agents on behalf of @f0ssel.

Add --non-interactive, --allow-open-prs, and --allow-breaking-changes to
scripts/releaser, and a workflow_dispatch workflow that runs it with the
release App token. release.yaml now accepts dispatches from the release
App.
Use the "Use workflow from" ref instead of a branch input and reject
anything other than release/X.Y. Point CONTRIBUTING.md at the workflow and
keep scripts/release.sh for cases the workflow does not cover.
@f0ssel
f0ssel marked this pull request as ready for review October 27, 2026 01:38
@f0ssel

f0ssel commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T18:27:40.959037Z 619644b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 313c1844fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/releaser/release.go Resolved
Comment thread scripts/releaser/release.go Resolved
Comment thread scripts/releaser/ui_test.go Resolved
…ractive mode

Treat failed open PR and PR metadata lookups as fatal when no override is
set, and rename the white-box test to ui_internal_test.go.
@f0ssel

f0ssel commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f47ec0c2df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/tag-release.yaml Resolved
@f0ssel

f0ssel commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee0095c262

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/releaser/release.go Resolved
@f0ssel

f0ssel commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 619644bbfc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# tag-release.yaml dispatches this workflow with the release App token,
# so the actor is the App's bot. Mint a token only to learn the App's
# slug and recognize it.
- name: Generate release App token

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to attribute to the human selecting the workflow? If I am understanding this right, we're still push button selecting the workflow and kicking it off vs. running a script and remotely kicking it off.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot trigger the release job as the tag trigger actor unfortunately, but we can pass the info into the tag annotations itself so we know who made it and what CI job created it. The Release job will be triggered by a bot identity still, but the original actor will be carried through and printed out in the release job itself and historically preserved in the tag.

Pass the user who started Tag release to release.yaml and record them in
the tag message. release.yaml shows the name in its run title and summary
only when the release App dispatched the run, and ignores the inputs on
manual runs.
zenithwolf1000
zenithwolf1000 previously approved these changes Oct 28, 2026

@zenithwolf1000 zenithwolf1000 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good wit it

Comment on lines +84 to +92
- name: Require a release branch
env:
REF: ${{ github.ref }}
run: |
set -euo pipefail
if [[ ! "$REF" =~ ^refs/heads/release/[0-9]+\.[0-9]+$ ]]; then
echo "::error::Select a release/X.Y branch in \"Use workflow from\", got: $REF"
exit 1
fi

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@f0ssel what do you think about taking the release branch as a workflow_dispatch input instead, so the workflow always runs from main? That way, we don't have to keep all branches in sync (which has bitten us before), at least when it comes to the tooling responsible for the release process.
We could use a worktree to interact with the release branch, or we could simply tag origin/release/X.Y directly after a full fetch. Thoughts?

@linear-code

linear-code Bot commented Nov 10, 2026

Copy link
Copy Markdown

CODAGT-1549

kylecarbs added a commit that referenced this pull request Nov 16, 2026
…val (#32212)

## Summary

**Unblocks releases after the `coder/coder` lockdown.** Only the
`coder-release-publisher` App can now create tags and release branches
(rulesets "Release tags (App only)" and "Release branch creation",
managed in `coder/github-org-terraform`). Its key is only available in
environments that need a **second release manager's approval**
(`release-managers`, no self-review, no admin bypass). People can't push
release tags anymore, so the tag is now created **inside the approved
release run**.

### Releasing (`./scripts/release.sh` works as before, minus one step)

1. Run `./scripts/release.sh` on `release/X.Y` (or `main` for an RC), as
today. It still picks the version, checks open PRs and breaking changes,
and writes the release notes.
2. Instead of creating and pushing the tag, it checks the commit is
already on `origin/<branch>` and dispatches `release.yaml` **on the
branch** with `version`, `commit`, `release_channel` and
`release_notes`.
3. The releaser prints the run's URL. GitHub also notifies the
`release-managers` reviewers. **Another release manager approves** the
run's `release` environment (Review deployments).
4. The approved job creates the annotated tag `version` at `commit` with
the App, then builds, signs and publishes that commit as before.

`release.yaml` can also be run by hand from the Actions UI with the same
inputs.

### `release.yaml`

- New `version` and `commit` inputs (required unless `dry_run`).
- The `release` job checks out `commit`. Before anything else, it:
  - refuses a malformed version;
- refuses a version that doesn't match the branch (`release/X.Y`, or
`main`/`release/X.Y` for `-rc.N`);
  - refuses a commit that isn't already on the dispatched branch;
  - refuses an existing tag that points elsewhere;
- otherwise creates the annotated tag with the App. A re-run reuses a
tag already at that commit.

  `version.sh` and the rest of the job are unchanged.
- **Homebrew and the `coder/packages` dispatch use the new
`coder-package-publisher` App** (`release-publish` environment) instead
of `CDRCI_GITHUB_TOKEN`. The dispatch moves to its own
`publish-packages` job in `release-publish`, where that key lives; it's
approved together with Homebrew and winget. Winget still uses the
`cdrci` machine user, since an App can't open PRs on
`microsoft/winget-pkgs`.
- Every App token is scoped to one repository and the permissions it
needs (`zizmor`'s `github-app` audit: 5 high findings to 0, one of which
predates this PR).

### `create-release-branch.yaml` (new)

Dispatched on `main` with `version` (e.g. `2.40`) and `commit`. After
approval in the `release-refs` environment, it creates `release/X.Y` at
that commit, refusing one that isn't on `main` or a branch that already
exists.

### `scripts/releaser`

- `ReleaseExecutor` drops `CreateTag`/`PushTag`.
- `TriggerWorkflow` dispatches on the branch with `version` and
`commit`.
- An existing tag must already point at HEAD.
- After dispatching, it looks up the run (`gh run list`, polling
briefly) and prints its URL and the approval steps.

## Before merging

- [ ] `RELEASE_APP_ID` and `RELEASE_APP_PRIVATE_KEY` set in the
**`release-refs`** environment (currently empty), and the rotated
release App key in `release`.
- [x] `CODER_PACKAGE_PUBLISHER_APP_ID` /
`CODER_PACKAGE_PUBLISHER_APP_PRIVATE_KEY` in `release-publish`; App
installed on `homebrew-coder` and `packages`.

## After merging: backport to every branch you release from

`release.yaml` runs from the dispatched branch's own copy, and
`./scripts/release.sh` runs the branch's releaser. So **each
`release/X.Y` needs this change before it can release**. Active lines by
recent tags: `release/2.39`, `2.38`, `2.37`, `2.36`, `2.35`, `2.34`,
`2.29`.

## Relation to #31321

#31321 (`Tag release`) runs the releaser non-interactively in CI. This
PR is the smaller change that unblocks releases now. #31321 can build on
it: its tagging job would need `environment: release-refs` (where the
App key lives) plus the extra App permissions it asks for, which are a
manifest change in `coder/github-org-terraform` `apps/`.

## Testing

- `go build`, `go vet`, `go test ./scripts/releaser` pass.
- `actionlint` and `zizmor` are clean on both workflows.
- Not exercised end to end. Suggest the first use be an RC
(`v2.40.0-rc.N` from `main`), watching the tag step.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kylecarbs added a commit that referenced this pull request Nov 16, 2026
…val (#32212)

**Unblocks releases after the `coder/coder` lockdown.** Only the
`coder-release-publisher` App can now create tags and release branches
(rulesets "Release tags (App only)" and "Release branch creation",
managed in `coder/github-org-terraform`). Its key is only available in
environments that need a **second release manager's approval**
(`release-managers`, no self-review, no admin bypass). People can't push
release tags anymore, so the tag is now created **inside the approved
release run**.

1. Run `./scripts/release.sh` on `release/X.Y` (or `main` for an RC), as
today. It still picks the version, checks open PRs and breaking changes,
and writes the release notes.
2. Instead of creating and pushing the tag, it checks the commit is
already on `origin/<branch>` and dispatches `release.yaml` **on the
branch** with `version`, `commit`, `release_channel` and
`release_notes`.
3. The releaser prints the run's URL. GitHub also notifies the
`release-managers` reviewers. **Another release manager approves** the
run's `release` environment (Review deployments).
4. The approved job creates the annotated tag `version` at `commit` with
the App, then builds, signs and publishes that commit as before.

`release.yaml` can also be run by hand from the Actions UI with the same
inputs.

- New `version` and `commit` inputs (required unless `dry_run`).
- The `release` job checks out `commit`. Before anything else, it:
  - refuses a malformed version;
- refuses a version that doesn't match the branch (`release/X.Y`, or
`main`/`release/X.Y` for `-rc.N`);
  - refuses a commit that isn't already on the dispatched branch;
  - refuses an existing tag that points elsewhere;
- otherwise creates the annotated tag with the App. A re-run reuses a
tag already at that commit.

  `version.sh` and the rest of the job are unchanged.
- **Homebrew and the `coder/packages` dispatch use the new
`coder-package-publisher` App** (`release-publish` environment) instead
of `CDRCI_GITHUB_TOKEN`. The dispatch moves to its own
`publish-packages` job in `release-publish`, where that key lives; it's
approved together with Homebrew and winget. Winget still uses the
`cdrci` machine user, since an App can't open PRs on
`microsoft/winget-pkgs`.
- Every App token is scoped to one repository and the permissions it
needs (`zizmor`'s `github-app` audit: 5 high findings to 0, one of which
predates this PR).

Dispatched on `main` with `version` (e.g. `2.40`) and `commit`. After
approval in the `release-refs` environment, it creates `release/X.Y` at
that commit, refusing one that isn't on `main` or a branch that already
exists.

- `ReleaseExecutor` drops `CreateTag`/`PushTag`.
- `TriggerWorkflow` dispatches on the branch with `version` and
`commit`.
- An existing tag must already point at HEAD.
- After dispatching, it looks up the run (`gh run list`, polling
briefly) and prints its URL and the approval steps.

- [ ] `RELEASE_APP_ID` and `RELEASE_APP_PRIVATE_KEY` set in the
**`release-refs`** environment (currently empty), and the rotated
release App key in `release`.
- [x] `CODER_PACKAGE_PUBLISHER_APP_ID` /
`CODER_PACKAGE_PUBLISHER_APP_PRIVATE_KEY` in `release-publish`; App
installed on `homebrew-coder` and `packages`.

`release.yaml` runs from the dispatched branch's own copy, and
`./scripts/release.sh` runs the branch's releaser. So **each
`release/X.Y` needs this change before it can release**. Active lines by
recent tags: `release/2.39`, `2.38`, `2.37`, `2.36`, `2.35`, `2.34`,
`2.29`.

PR is the smaller change that unblocks releases now. #31321 can build on
it: its tagging job would need `environment: release-refs` (where the
App key lives) plus the extra App permissions it asks for, which are a
manifest change in `coder/github-org-terraform` `apps/`.

- `go build`, `go vet`, `go test ./scripts/releaser` pass.
- `actionlint` and `zizmor` are clean on both workflows.
- Not exercised end to end. Suggest the first use be an RC
(`v2.40.0-rc.N` from `main`), watching the tag step.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 12766ec)
@f0ssel f0ssel closed this Nov 16, 2026
@f0ssel
f0ssel temporarily deployed to main November 16, 2026 18:40 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
main — 7b27ca0d Deployed Nov 16, 2026 by f0ssel via cla #258095
docs-preview — 7b27ca0d Deployed Nov 16, 2026 by f0ssel via cleanup #127
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants