diff --git a/.claude/commands/release.md b/.claude/commands/release.md index 25ae77b3e..f4524fb42 100644 --- a/.claude/commands/release.md +++ b/.claude/commands/release.md @@ -4,107 +4,37 @@ Release all packages with the specified version. ## Arguments -- `$ARGUMENTS`: The version number (semver) +- `$ARGUMENTS`: The version number (semver, e.g., `3.13.0`) -## Pre-flight Checks +## Usage -1. Ensure working directory is clean: `git status --porcelain` -2. Ensure on main branch: `git branch --show-current` - -## Release Steps - -### 1. Update Package Versions - -Update all `package.json` files to the new version: +Run the release script: ```bash -sd '"version": "[^"]+"' '"version": "$ARGUMENTS"' packages/*/package.json +bun scripts/release.ts $ARGUMENTS ``` -Verify: -```bash -grep -h '"version"' packages/*/package.json -``` +The script handles everything automatically: +1. Pre-flight checks (clean working dir, on main branch) +2. Updates all package.json versions +3. Regenerates bun.lock +4. Updates CHANGELOGs ([Unreleased] → [version] - date) +5. Commits and tags +6. Pushes to origin +7. Watches CI until all workflows pass -### 2. Regenerate Lockfile +## Handling CI Failures -Regenerate `bun.lock` so workspace dependencies resolve to the new version: +If CI fails, the script exits with an error. Fix the issue, then: ```bash -rm bun.lock && bun install +git commit --amend --no-edit +git push origin main --force +git tag -f v$ARGUMENTS && git push origin v$ARGUMENTS --force ``` -### 3. Update Changelogs - -Replace `[Unreleased]` with the version and date in all changelogs: +Then re-watch CI: ```bash -sd '## \[Unreleased\]' '## [$ARGUMENTS] - $(date +%Y-%m-%d)' packages/*/CHANGELOG.md -``` - -Then add new `[Unreleased]` sections for the next cycle: - -```bash -sd '^(# Changelog\n\n)' '$1## [Unreleased]\n\n' packages/*/CHANGELOG.md -``` - -If the multiline replace doesn't work, use sed: -```bash -for f in packages/*/CHANGELOG.md; do - sed -i 's/^# Changelog$/# Changelog\n\n## [Unreleased]/' "$f" -done -``` - -Fix any duplicate `[Unreleased]` sections: -```bash -sd '## \[Unreleased\]\n\n## \[Unreleased\]' '## [Unreleased]' packages/*/CHANGELOG.md -``` - -### 4. Commit and Tag - -```bash -git add . -git commit -m "chore: bump version to $ARGUMENTS" -git tag v$ARGUMENTS -``` - -### 5. Push - -```bash -git push origin main -git push origin v$ARGUMENTS -``` - -### 6. Watch CI - -Monitor the GitHub Actions workflow: - -```bash -# Get the latest run ID -gh run list --limit 1 --json databaseId,status - -# Watch until completion -gh run watch --exit-status -``` - -### 7. Handle CI Failures - -If CI fails: - -1. Read the error from the workflow output -2. Fix the issue locally -3. Amend the commit: `git commit --amend --no-edit` -4. Force push: `git push origin main --force` -5. Update the tag: `git tag -f v$ARGUMENTS && git push origin v$ARGUMENTS --force` -6. Watch CI again until it passes - -Repeat until CI is green. - -## Post-Release - -After CI passes, the release is complete. The tag `v$ARGUMENTS` points to the final commit. - -If publishing to npm is needed: -```bash -npm run publish +gh run list --commit $(git rev-parse HEAD) --json name,status,conclusion ```