--- name: prepare-release description: Analyze merged PRs since the last release, determine the next version, update the changelog, open the PR, and populate the draft GitHub release notes for a new swift-mocking release. --- # Prepare Release Runs `generate-release-info` to collect PR data and compute the next version, then creates the changelog branch, updates `CHANGELOG.md`, opens a documentation PR, and populates the draft GitHub release notes. The computed version is a default, not a mandate: if the user asks for a specific target version when invoking the skill (e.g. "bump to 1.0.0"), that overrides the computed value — see step 5. When done, report the PR URL and tell the user to invoke `/publish-release` once the PR is merged. ## 1. Sync with main Fetch origin — including tags — and hard-reset to `origin/main`. Do not use `git pull` — it can produce merge commits that the repo's branch protection rules reject on push. Fetch tags explicitly with `--tags`: `generate-release-info` derives `last_version` from local tags, and `publish-release` creates each release tag on GitHub (via `gh release edit --draft=false`), so a just-published tag exists remotely but not locally until fetched. A bare `git fetch` only follows tags reachable from fetched branches; `--tags` guarantees every release tag is present, so `last_version` is never computed from a stale local tag. ```sh git fetch origin --tags git checkout main git reset --hard origin/main ``` ## 2. Run generate-release-info ```sh .claude/skills/prepare-release/scripts/generate-release-info ``` This outputs one of two things: - **Unlabeled PRs (exit 1):** Only a `### ⚠️ Needs Label` section — no version or changelog sections. Handle this in step 3 before proceeding. - **Success (exit 0):** `last_version` and `next_version` on the first line(s), followed by pre-formatted changelog sections ready to paste directly into `CHANGELOG.md` and the release notes. When the current version is pre-1.0 and the release contains a breaking change, two extra lines appear after `next_version` (`breaking_change_pre_1_0: true` and `major_version_option: 1.0.0`) — resolve them in step 5 before using `next_version`. PRs labeled `breaking changes` appear in their categorization section with a `⚠️ **[BREAKING]**` prefix. A breaking change bumps the major version (e.g. `1.4.2` → `2.0.0`) — **except** when the current version is pre-1.0 (`0.x.y`), where the public API is considered unstable and a breaking change is only a minor bump by default (e.g. `0.3.0` → `0.4.0`). See step 5. ## 3. Resolve unlabeled PRs If the script exited with `### ⚠️ Needs Label`, those PRs had no categorization label. The script produces no version number or changelog output until this is resolved — do not proceed to later steps. For each unlabeled PR, present its title and number, then ask the user to pick a label: ``` 1. enhancement 2. bug 3. documentation 4. testing 5. refactoring 6. formatting 7. dependencies 8. ci 9. chore ``` Apply the chosen label: ```sh gh pr edit --repo fetch-rewards/swift-mocking --add-label