|
| 1 | +--- |
| 2 | +name: release |
| 3 | +description: >- |
| 4 | + Bumps RubyProxyHeaders::VERSION in lib/ruby_proxy_headers/version.rb, opens a PR from |
| 5 | + branch release/VERSION toward main with auto-merge, and coordinates with CI that |
| 6 | + publishes a GitHub Release when that branch merges. Use when the user invokes /release, |
| 7 | + /release VERSION, asks for a release PR, version bump, or release automation. |
| 8 | +--- |
| 9 | + |
| 10 | +# Release (`/release` and optional VERSION) |
| 11 | + |
| 12 | +## When this applies |
| 13 | + |
| 14 | +- User message starts with **`/release`** or **`/release VERSION`** (VERSION optional). |
| 15 | +- User asks to cut a release, bump the gem version, or open a release PR with auto-merge. |
| 16 | + |
| 17 | +## Preconditions |
| 18 | + |
| 19 | +- Working tree clean (`git status`); stash or commit unrelated work first. |
| 20 | +- `gh` CLI authenticated (`gh auth status`). |
| 21 | +- Remote `origin` is GitHub. |
| 22 | +- Repository allows **auto-merge** (Settings → General → Pull Requests → Allow auto-merge). If auto-merge is unavailable, open the PR anyway and tell the user to merge manually after checks pass. |
| 23 | + |
| 24 | +## Version selection |
| 25 | + |
| 26 | +1. Read the current version from `lib/ruby_proxy_headers/version.rb` (`RubyProxyHeaders::VERSION`, semver `MAJOR.MINOR.PATCH`). |
| 27 | +2. If **VERSION was provided**: set the new version to that string (must match `^\d+\.\d+\.\d+` unless the project already uses a different scheme—then follow the existing file format). |
| 28 | +3. If **VERSION was omitted**: bump the **patch** segment only (e.g. `0.2.1` → `0.2.2`). If the current value is not `x.y.z`, stop and ask the user for an explicit VERSION. |
| 29 | + |
| 30 | +## Git identity (this repo) |
| 31 | + |
| 32 | +Configure once if needed: |
| 33 | + |
| 34 | +```bash |
| 35 | +git config user.email "cursor@proxymesh.com" |
| 36 | +git config user.name "Cursor" |
| 37 | +``` |
| 38 | + |
| 39 | +## Steps |
| 40 | + |
| 41 | +1. **Sync main** |
| 42 | + |
| 43 | + ```bash |
| 44 | + git fetch origin main |
| 45 | + ``` |
| 46 | + |
| 47 | +2. **Compute** `NEW_VERSION` (per rules above). **Branch name** is `release/${NEW_VERSION}` (no `v` prefix in the branch name). |
| 48 | + |
| 49 | +3. **Create branch from latest main** |
| 50 | + |
| 51 | + ```bash |
| 52 | + git checkout -B "release/${NEW_VERSION}" origin/main |
| 53 | + ``` |
| 54 | + |
| 55 | +4. **Edit** `lib/ruby_proxy_headers/version.rb`: set `VERSION = 'NEW_VERSION'` (single-quoted string). |
| 56 | + |
| 57 | +5. **Commit and push** (never push to `main`; push only the release branch) |
| 58 | + |
| 59 | + ```bash |
| 60 | + git add lib/ruby_proxy_headers/version.rb |
| 61 | + git commit -m "chore: bump version to ${NEW_VERSION}" |
| 62 | + git push -u origin "release/${NEW_VERSION}" |
| 63 | + ``` |
| 64 | + |
| 65 | +6. **Open PR** into `main` with a short body (no Cursor boilerplate). Example: |
| 66 | + |
| 67 | + ```bash |
| 68 | + gh pr create --base main --head "release/${NEW_VERSION}" \ |
| 69 | + --title "Release ${NEW_VERSION}" \ |
| 70 | + --body "Bumps the gem version to ${NEW_VERSION} for release." |
| 71 | + ``` |
| 72 | + |
| 73 | +7. **Enable auto-merge** after the PR exists. In non-interactive mode, `gh` requires an explicit merge strategy with `--auto` (use the repository default: usually **`--merge`** for a merge commit, or **`--squash`** / **`--rebase`** if that is what the repo uses). |
| 74 | + |
| 75 | + ```bash |
| 76 | + gh pr merge <PR_NUMBER_OR_URL> --auto --merge |
| 77 | + ``` |
| 78 | + |
| 79 | + If `--auto` fails (permissions, auto-merge disabled, or pending checks), leave the PR open and report the error; the user can merge manually after CI passes. You can poll with `gh pr checks <PR_NUMBER_OR_URL> --watch` then retry `gh pr merge ... --auto --merge`, or merge manually. |
| 80 | + |
| 81 | +## After merge |
| 82 | + |
| 83 | +Merging the PR into `main` runs **Release on merge** (`.github/workflows/github_release_on_release_branch_merge.yml`), which creates a **GitHub Release** for tag `v{version}` from the merge commit. Because releases created with the default `GITHUB_TOKEN` do not trigger other workflows, **Push Gem** (`push_gem.yml`) is also started via **`workflow_run`** when that release workflow finishes. Manual or API-created releases still match the `release: published` trigger on `push_gem.yml`. |
| 84 | + |
| 85 | +## Quick reference |
| 86 | + |
| 87 | +| Input | Result | |
| 88 | +|--------------------|---------------------------------------------| |
| 89 | +| `/release` | Patch bump, branch `release/x.y.(z+1)` | |
| 90 | +| `/release 1.4.0` | Version `1.4.0`, branch `release/1.4.0` | |
0 commit comments