|
| 1 | +--- |
| 2 | +name: release |
| 3 | +description: Bump the project version in build.gradle and create a matching annotated git tag. |
| 4 | +user-invocable: true |
| 5 | +allowed-tools: |
| 6 | + - Bash |
| 7 | + - Read |
| 8 | + - Grep |
| 9 | + - Glob |
| 10 | +--- |
| 11 | + |
| 12 | +# /release — Bump the project version and create a matching git tag. |
| 13 | + |
| 14 | +You are modifying this project's Gradle build scripts to increment the version as well as create a new git |
| 15 | +tag to push & initiate a release process (GitHub Actions workflow). |
| 16 | + |
| 17 | +Examples: `/release 1.0.0-alpha.3`, `/release 1.0.0-beta.1`, `/release 1.0.0` |
| 18 | + |
| 19 | +Arguments passed: `$ARGUMENTS` |
| 20 | + |
| 21 | +`$ARGUMENTS` is a semantic version string (without the `v` prefix) that will be set as the new version in `build.gradle` |
| 22 | +and used for the git tag. It should follow semver or semver-pre format, e.g. `1.0.0`, `1.0.0-alpha.3`, `1.0.0-beta.1`. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Steps |
| 27 | + |
| 28 | +1. **Validate the argument.** The argument is the new version string (no `v` prefix). If it's blank or doesn't look like a semver/semver-pre string, stop and ask the user to provide one. |
| 29 | + |
| 30 | +2. **Show the current state.** Run `git tag --sort=-version:refname | head -5` and read `build.gradle` to show the user the current version (line containing `version = '...'` in the `allprojects` block) and the most recent tags. |
| 31 | + |
| 32 | +3. **Update `build.gradle`.** In the `allprojects { ... }` block, replace the existing `version = '...'` line with `version = '<new-version>'`. Use the Edit tool. |
| 33 | + |
| 34 | +4. **Run `./gradlew spotlessApply`** to ensure formatting is clean before committing. |
| 35 | + |
| 36 | +5. **Ask about additional changes.** Before committing, ask the user: "Any other changes to include in this commit?" Wait for their response. If they say yes, apply those changes before staging. If no, proceed. |
| 37 | + |
| 38 | +6. **Commit the version bump.** Stage `build.gradle` plus any additional files the user specified and commit: |
| 39 | + ``` |
| 40 | + chore: bump version to <new-version> |
| 41 | + ``` |
| 42 | + No `closes #N`, no co-author trailer needed for version bumps. |
| 43 | + |
| 44 | +7. **Create the annotated tag.** |
| 45 | + ``` |
| 46 | + git tag -a v<new-version> -m "Release v<new-version>" |
| 47 | + ``` |
| 48 | + |
| 49 | +8. **Confirm.** Show the user: |
| 50 | + - The new version in `build.gradle` |
| 51 | + - The tag just created (`git show v<new-version> --stat`) |
| 52 | + - A reminder: `git push && git push --tags` to publish (don't push automatically) |
0 commit comments