chore(release): always version release artifacts via a PR in the /release command

This commit is contained in:
Paulo Castellano 2026-07-18 16:20:47 -03:00
parent 47c8224083
commit 32bee12086

View file

@ -200,31 +200,46 @@ ### Step 6 — Confirm with the user
- GitHub release `<version>`
- `releases/<version>/changelog.md`
- `releases/<version>/email.md`
- Branch `chore/release-<version>-artifacts` + a PR versioning the two files above
Then ask in Portuguese: **"Crio a tag, publico o release e salvo os arquivos?"**
Then ask in Portuguese: **"Crio a tag, publico o release e abro o PR com os arquivos?"**
Do **not** proceed without explicit yes.
### Step 7 — Execute
After confirmation, in this exact order:
After confirmation, in this exact order. Steps 4–6 (tag + release) run from `main` so the tag stays on the released `main` commit; steps 7–8 version the artifacts on a separate branch and open a PR.
1. Create local directory: `mkdir -p releases/<version>`
2. Write `releases/<version>/changelog.md` with the Step 3 content (raw GitHub markdown).
3. Write `releases/<version>/email.md` with frontmatter + humanized body.
4. Create annotated tag: `git tag -a <version> -m "Release <version>"`
4. From `main`, create the annotated tag: `git tag -a <version> -m "Release <version>"`
5. Push tag: `git push origin <version>`
6. Create the GitHub release using the changelog file as body:
```bash
gh release create <version> --title "<version>" --notes-file releases/<version>/changelog.md
```
7. Report to the user:
- GitHub release URL (from `gh` output)
7. Version the artifacts on a branch (the two files carry over from the working tree) and push:
```bash
git checkout -b chore/release-<version>-artifacts
git add releases/<version>/changelog.md releases/<version>/email.md
git commit -m "chore(release): add <version> changelog + customer email artifacts"
git push -u origin chore/release-<version>-artifacts
```
8. Open the PR against `main` (body: what the two files are + a link to the GitHub release):
```bash
gh pr create --base main --head chore/release-<version>-artifacts \
--title "chore(release): <version> changelog + customer email artifacts" \
--body "<short body — the two artifact files + link to the release>"
```
9. Report to the user:
- GitHub release URL (from `gh release` output)
- PR URL (from `gh pr create` output)
- Local paths: `releases/<version>/changelog.md`, `releases/<version>/email.md`
- Reminder: *"Os arquivos em `releases/<version>/` não foram commitados. Commit depois se quiser preservar o histórico no repo."*
### On failure
- `git push origin <version>` fails: report the exact error, leave the local tag in place, do not retry destructively.
- `gh release create` fails: the tag is already pushed; tell the user they can recreate manually with `gh release create <version> --title "<version>" --notes-file releases/<version>/changelog.md`.
- `git push` / `gh pr create` for the artifacts branch fails: the tag and GitHub release are already live; report the error and tell the user they can open the PR manually from `chore/release-<version>-artifacts`.
- `Skill` or `Write` failure during artifact prep: report and stop. Do not push the tag without the artifacts being prepared.