|
| 1 | +--- |
| 2 | +description: "Create a new release: bump version, create PR, build mainnet, publish draft release" |
| 3 | +argument_hint: "[--critical]" |
| 4 | +allowed_tools: Bash, Read, Edit, Write, Glob, Grep, AskUserQuestion, mcp__github__create_pull_request, mcp__github__list_pull_requests, mcp__github__pull_request_read, mcp__github__get_file_contents, mcp__github__update_pull_request |
| 5 | +--- |
| 6 | + |
| 7 | +Automate the full release process for bitkit-android. |
| 8 | + |
| 9 | +**Examples:** |
| 10 | +- `/release` - Interactive, prompts for version (defaults to patch bump) |
| 11 | +- `/release --critical` - Same, but marks the release as critical in release.json |
| 12 | + |
| 13 | +## Steps |
| 14 | + |
| 15 | +### 1. Read Current Version |
| 16 | + |
| 17 | +Read `app/build.gradle.kts` and extract: |
| 18 | +- `versionCode` (integer, e.g. `176`) |
| 19 | +- `versionName` (string, e.g. `"2.0.2"`) |
| 20 | + |
| 21 | +Parse versionName into `{major}.{minor}.{patch}` components. |
| 22 | + |
| 23 | +Compute defaults: |
| 24 | +- Next patch: `{major}.{minor}.{patch+1}` |
| 25 | +- Next minor: `{major}.{minor+1}.0` |
| 26 | +- Next major: `{major+1}.0.0` |
| 27 | +- Next versionCode: `versionCode + 1` |
| 28 | + |
| 29 | +### 2. Parse Arguments |
| 30 | + |
| 31 | +From `$ARGUMENTS`: |
| 32 | +- `--critical`: Set `critical: true` in `.github/release.json` (default: `false`) |
| 33 | + |
| 34 | +### 3. Ask for Version |
| 35 | + |
| 36 | +Use `AskUserQuestion` with header "Version": |
| 37 | + |
| 38 | +**Question:** `"New version? (current: {versionName}, build {versionCode})"` |
| 39 | + |
| 40 | +**Options:** |
| 41 | +1. `{major}.{minor}.{patch+1}` (Recommended) — description: "Patch release" |
| 42 | +2. `{major}.{minor+1}.0` — description: "Minor release" |
| 43 | +3. `{major+1}.0.0` — description: "Major release" |
| 44 | + |
| 45 | +The user can always pick "Other" to enter a custom version string. |
| 46 | + |
| 47 | +Store the chosen version as `newVersionName` and compute `newVersionCode = versionCode + 1`. |
| 48 | + |
| 49 | +### 4. Create Release Branch & Bump Version |
| 50 | + |
| 51 | +```bash |
| 52 | +git checkout master |
| 53 | +git pull origin master |
| 54 | +git checkout -b release/{newVersionCode} |
| 55 | +``` |
| 56 | + |
| 57 | +Edit `app/build.gradle.kts`: |
| 58 | +- Change `versionCode = {old}` to `versionCode = {newVersionCode}` |
| 59 | +- Change `versionName = "{old}"` to `versionName = "{newVersionName}"` |
| 60 | + |
| 61 | +```bash |
| 62 | +git add app/build.gradle.kts |
| 63 | +git commit -m "chore: version {newVersionName}" |
| 64 | +git push -u origin release/{newVersionCode} |
| 65 | +``` |
| 66 | + |
| 67 | +### 5. Create Version Bump PR |
| 68 | + |
| 69 | +Read `.github/pull_request_template.md` for structure. Create PR: |
| 70 | + |
| 71 | +- **Title:** `chore: bump version {newVersionName}` |
| 72 | +- **Base:** master |
| 73 | +- **Body:** |
| 74 | +``` |
| 75 | +Bump version to {newVersionName} (build {newVersionCode}) for release. |
| 76 | +
|
| 77 | +### Description |
| 78 | +
|
| 79 | +- `versionCode`: {oldVersionCode} → {newVersionCode} |
| 80 | +- `versionName`: {oldVersionName} → {newVersionName} |
| 81 | +
|
| 82 | +### Preview |
| 83 | +
|
| 84 | +N/A |
| 85 | +
|
| 86 | +### QA Notes |
| 87 | +
|
| 88 | +N/A |
| 89 | +``` |
| 90 | + |
| 91 | +Store the PR URL for the summary. |
| 92 | + |
| 93 | +### 6. Build Mainnet Release |
| 94 | + |
| 95 | +```bash |
| 96 | +./gradlew assembleMainnetRelease |
| 97 | +``` |
| 98 | + |
| 99 | +Expected APK path: `app/build/outputs/apk/mainnet/release/bitkit-mainnet-release-{newVersionCode}-universal.apk` |
| 100 | + |
| 101 | +Verify the file exists. If the build fails, stop and report the error to the user. |
| 102 | + |
| 103 | +### 7. Update `.github/release.json` |
| 104 | + |
| 105 | +Get current UTC timestamp: `date -u +"%Y-%m-%dT%H:%M:%SZ"` |
| 106 | + |
| 107 | +Write `.github/release.json`: |
| 108 | +```json |
| 109 | +{ |
| 110 | + "platforms": { |
| 111 | + "android": { |
| 112 | + "version": "v{newVersionName}", |
| 113 | + "buildNumber": {newVersionCode}, |
| 114 | + "notes": "https://github.com/synonymdev/bitkit/releases/tag/v{newVersionName}", |
| 115 | + "pub_date": "{UTC timestamp}", |
| 116 | + "url": "https://play.google.com/store/apps/details?id=to.bitkit", |
| 117 | + "critical": {true if --critical flag, false otherwise} |
| 118 | + } |
| 119 | + } |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +Commit and push: |
| 124 | +```bash |
| 125 | +git add .github/release.json |
| 126 | +git commit -m "chore: update release.json" |
| 127 | +git push |
| 128 | +``` |
| 129 | + |
| 130 | +### 8. Tag & Push |
| 131 | + |
| 132 | +Determine the previous version tag for changelog generation: `v{oldVersionName}`. |
| 133 | + |
| 134 | +```bash |
| 135 | +git tag -a v{newVersionName} -m "v{newVersionName}" |
| 136 | +git push origin v{newVersionName} |
| 137 | +``` |
| 138 | + |
| 139 | +### 9. Create Draft GitHub Release |
| 140 | + |
| 141 | +```bash |
| 142 | +gh release create v{newVersionName} \ |
| 143 | + --title "v{newVersionName}" \ |
| 144 | + --draft \ |
| 145 | + --generate-notes \ |
| 146 | + --notes-start-tag v{oldVersionName} |
| 147 | +``` |
| 148 | + |
| 149 | +### 10. Upload APK to Draft Release |
| 150 | + |
| 151 | +```bash |
| 152 | +gh release upload v{newVersionName} \ |
| 153 | + app/build/outputs/apk/mainnet/release/bitkit-mainnet-release-{newVersionCode}-universal.apk |
| 154 | +``` |
| 155 | + |
| 156 | +### 11. Return to Master |
| 157 | + |
| 158 | +```bash |
| 159 | +git checkout master |
| 160 | +``` |
| 161 | + |
| 162 | +### 12. Output Summary |
| 163 | + |
| 164 | +``` |
| 165 | +Release v{newVersionName} (build {newVersionCode}) |
| 166 | +
|
| 167 | +Version bump PR: {PR URL} |
| 168 | +Release branch: release/{newVersionCode} |
| 169 | +Tag: v{newVersionName} |
| 170 | +Draft release: {release URL} |
| 171 | +APK uploaded: bitkit-mainnet-release-{newVersionCode}-universal.apk |
| 172 | +
|
| 173 | +Next: publish the draft release on GitHub when ready. |
| 174 | +``` |
0 commit comments