|
| 1 | +# Ship Skill |
| 2 | + |
| 3 | +Executes a full release cycle for the sbt-ossuminc plugin. |
| 4 | +Follow each step in order. **STOP immediately** if any |
| 5 | +assertion fails and report the problem. |
| 6 | + |
| 7 | +## Arguments |
| 8 | + |
| 9 | +The user should provide a version number (e.g., `1.3.6`). If |
| 10 | +not provided: |
| 11 | +1. Run `git tag --sort=-v:refname | head -5` to find the |
| 12 | + actual latest tag (not just reachable from current branch) |
| 13 | +2. Run `git log --oneline <latest-tag>..HEAD` to see changes |
| 14 | +3. Analyze per semver and **recommend** a version (don't ask |
| 15 | + the user to choose — present your recommendation and let |
| 16 | + them confirm or override) |
| 17 | + |
| 18 | +## Pre-Flight Checks |
| 19 | + |
| 20 | +1. Assert current branch is `main`: |
| 21 | + ``` |
| 22 | + git branch --show-current |
| 23 | + ``` |
| 24 | + If not on `main`, ask the user before switching. **Never |
| 25 | + publish from `development` or feature branches.** |
| 26 | + |
| 27 | +2. Assert working tree is clean: |
| 28 | + ``` |
| 29 | + git status --porcelain |
| 30 | + ``` |
| 31 | + If dirty, list the uncommitted files and ask the user how |
| 32 | + to proceed. |
| 33 | + |
| 34 | +3. **GITHUB_TOKEN handling**: Do NOT `unset GITHUB_TOKEN` |
| 35 | + globally — sbt needs it for GitHub Packages resolution. |
| 36 | + Only unset it immediately before `gh` commands: |
| 37 | + ``` |
| 38 | + unset GITHUB_TOKEN && gh ... |
| 39 | + ``` |
| 40 | + |
| 41 | +4. When switching to `main`, always `git pull` first to |
| 42 | + ensure local main is up to date with origin. |
| 43 | + |
| 44 | +5. Verify the version tag does not already exist: |
| 45 | + ``` |
| 46 | + git tag -l <VERSION> |
| 47 | + ``` |
| 48 | + |
| 49 | +## Ship Steps |
| 50 | + |
| 51 | +6. **Ensure the working tree is clean before tagging.** |
| 52 | + sbt-dynver derives the version from `git describe`; |
| 53 | + any dirty tree causes it to append a |
| 54 | + `<VERSION>-N-<hash>-<timestamp>` suffix instead of |
| 55 | + the clean `<VERSION>`. This suffix would propagate |
| 56 | + to all published artifacts. Check: |
| 57 | + ``` |
| 58 | + git status --porcelain |
| 59 | + ``` |
| 60 | + If any files are modified or untracked, commit them |
| 61 | + now before proceeding. |
| 62 | + |
| 63 | +7. Create an annotated git tag: |
| 64 | + ``` |
| 65 | + git tag -a <VERSION> -m "Release <VERSION>" |
| 66 | + ``` |
| 67 | + |
| 68 | +8. Verify dynver resolves to the clean version: |
| 69 | + ``` |
| 70 | + sbt 'show version' |
| 71 | + ``` |
| 72 | + The output must be exactly `<VERSION>` with no suffix. |
| 73 | + If it has a suffix, do NOT proceed — delete the tag |
| 74 | + (`git tag -d <VERSION>`), fix the issue, and re-tag. |
| 75 | + |
| 76 | +9. Run the full test suite including scripted plugin tests |
| 77 | + and publish: |
| 78 | + ``` |
| 79 | + sbt clean test scripted publish |
| 80 | + ``` |
| 81 | + Scripted tests validate the plugin from a consumer's |
| 82 | + perspective. Do NOT skip them. Because the tag is on |
| 83 | + HEAD and the tree is clean, all published artifacts |
| 84 | + will carry the clean `<VERSION>`. Verify in the sbt |
| 85 | + output. |
| 86 | + **If tests fail, delete the tag** (`git tag -d |
| 87 | + <VERSION>`) — do NOT push a broken release. |
| 88 | + |
| 89 | +10. Push commits and tag to origin: |
| 90 | + ``` |
| 91 | + git push origin main <VERSION> |
| 92 | + ``` |
| 93 | +
|
| 94 | +11. Create a GitHub release: |
| 95 | + ``` |
| 96 | + unset GITHUB_TOKEN && gh release create <VERSION> \ |
| 97 | + --title "Release <VERSION>" --generate-notes |
| 98 | + ``` |
| 99 | + This triggers the `release.yml` workflow which also |
| 100 | + uploads JAR artifacts to the release. |
| 101 | +
|
| 102 | +## Post-Release Verification |
| 103 | +
|
| 104 | +12. Confirm the release exists: |
| 105 | + ``` |
| 106 | + unset GITHUB_TOKEN && gh release view <VERSION> |
| 107 | + ``` |
| 108 | +
|
| 109 | +13. Run `git status` to confirm the working tree is clean. |
| 110 | +
|
| 111 | +14. Switch back to `development` and merge the tag forward: |
| 112 | + ``` |
| 113 | + git checkout development |
| 114 | + git merge main |
| 115 | + git push |
| 116 | + ``` |
| 117 | +
|
| 118 | +15. Report a summary: tag, commit SHA, release URL, and any |
| 119 | + CI workflows triggered. |
| 120 | +
|
| 121 | +16. **Drop upgrade tasks in dependent projects.** For each |
| 122 | + consumer of sbt-ossuminc, create a task file in its |
| 123 | + `task/` directory describing the plugin version bump |
| 124 | + needed. The file should be named |
| 125 | + `upgrade-sbt-ossuminc-<VERSION>.md` and contain: |
| 126 | + - What changed (link to the GitHub release) |
| 127 | + - The new version to depend on |
| 128 | + - The file to update (`project/plugins.sbt`) |
| 129 | +
|
| 130 | + Consumer projects: |
| 131 | + ``` |
| 132 | + ../riddl/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 133 | + ../synapify/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 134 | + ../riddl-idea-plugin/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 135 | + ../riddlsim/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 136 | + ../ossum.tech/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 137 | + ../riddl-mcp-server/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 138 | + ../riddl-models/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 139 | + ../ossum-ai-api/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 140 | + ../riddl-gen/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 141 | + ../riddl-examples/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 142 | + ../riddl-server-infrastructure/task/upgrade-sbt-ossuminc-<VERSION>.md |
| 143 | + ``` |
| 144 | +
|
| 145 | +## If Something Fails |
| 146 | +
|
| 147 | +- If tests fail in step 9: delete the local tag |
| 148 | + (`git tag -d <VERSION>`), fix, and restart from step 6. |
| 149 | + Do NOT push a broken tag. |
| 150 | +- If scripted tests fail in step 9: this means the plugin |
| 151 | + is broken for consumers. Fix before releasing. |
| 152 | +- If dynver shows a suffix in step 8: delete the tag, fix |
| 153 | + the dirty tree, and re-tag. |
| 154 | +- If tag push fails in step 10: check if tag exists |
| 155 | + remotely. |
| 156 | +- If publish fails in step 9: check credentials and retry |
| 157 | + (tag is still local, safe to retry). |
| 158 | +- If `gh release create` fails in step 11: the tag is |
| 159 | + already pushed, so the release can be created manually |
| 160 | + or retried. |
| 161 | +- **Never force-push tags** without explicit user approval. |
0 commit comments