|
| 1 | +# Ship Skill |
| 2 | + |
| 3 | +Executes a full release cycle for the riddl project. Follow each |
| 4 | +step in order. **STOP immediately** if any assertion fails and |
| 5 | +report the problem. |
| 6 | + |
| 7 | +## Arguments |
| 8 | + |
| 9 | +The user should provide a version number (e.g., `1.10.1`). 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 BuildInfo, all published artifacts, and npm |
| 57 | + packages. Check: |
| 58 | + ``` |
| 59 | + git status --porcelain |
| 60 | + ``` |
| 61 | + If any files are modified or untracked, commit them |
| 62 | + now before proceeding. |
| 63 | + |
| 64 | +7. Create an annotated git tag: |
| 65 | + ``` |
| 66 | + git tag -a <VERSION> -m "Release <VERSION>" |
| 67 | + ``` |
| 68 | + |
| 69 | +8. Verify dynver resolves to the clean version: |
| 70 | + ``` |
| 71 | + sbt 'show riddlc/version' |
| 72 | + ``` |
| 73 | + The output must be exactly `<VERSION>` with no suffix. |
| 74 | + If it has a suffix, do NOT proceed — delete the tag |
| 75 | + (`git tag -d <VERSION>`), fix the issue, and re-tag. |
| 76 | + |
| 77 | +9. Run the full test suite and publish all modules: |
| 78 | + ``` |
| 79 | + sbt clean test publish |
| 80 | + ``` |
| 81 | + Because the tag is on HEAD and the tree is clean, |
| 82 | + BuildInfo and all published artifacts will carry the |
| 83 | + clean `<VERSION>`. Verify in the sbt output. |
| 84 | + **If tests fail, delete the tag** (`git tag -d |
| 85 | + <VERSION>`) — do NOT push a broken release. |
| 86 | + |
| 87 | +10. Push commits and tag to origin: |
| 88 | + ``` |
| 89 | + git push origin main <VERSION> |
| 90 | + ``` |
| 91 | +
|
| 92 | +11. Create a GitHub release: |
| 93 | + ``` |
| 94 | + unset GITHUB_TOKEN && gh release create <VERSION> \ |
| 95 | + --title "Release <VERSION>" --generate-notes |
| 96 | + ``` |
| 97 | + This triggers the Release Artifacts workflow (native |
| 98 | + builds, Homebrew formula update) and the npm-publish |
| 99 | + workflow automatically. |
| 100 | +
|
| 101 | +## Post-Release Verification |
| 102 | +
|
| 103 | +12. Confirm the release exists: |
| 104 | + ``` |
| 105 | + unset GITHUB_TOKEN && gh release view <VERSION> |
| 106 | + ``` |
| 107 | +
|
| 108 | +13. Run `git status` to confirm the working tree is clean. |
| 109 | +
|
| 110 | +14. Switch back to `development` and merge the tag forward: |
| 111 | + ``` |
| 112 | + git checkout development |
| 113 | + git merge main |
| 114 | + git push |
| 115 | + ``` |
| 116 | +
|
| 117 | +15. Report a summary: tag, commit SHA, release URL, and any |
| 118 | + CI workflows triggered. |
| 119 | +
|
| 120 | +16. **Drop upgrade tasks in dependent projects.** For each |
| 121 | + consumer of riddl, create a task file in its `task/` |
| 122 | + directory describing the version bump needed. The file |
| 123 | + should be named `upgrade-riddl-<VERSION>.md` and contain: |
| 124 | + - What changed (link to the GitHub release) |
| 125 | + - The new version to depend on |
| 126 | + - Which files to update (e.g., `project/Dependencies.scala`, |
| 127 | + `build.sbt`, or `package.json`) |
| 128 | +
|
| 129 | + Consumer projects: |
| 130 | + ``` |
| 131 | + ../synapify/task/upgrade-riddl-<VERSION>.md |
| 132 | + ../riddl-idea-plugin/task/upgrade-riddl-<VERSION>.md |
| 133 | + ../riddlsim/task/upgrade-riddl-<VERSION>.md |
| 134 | + ../ossum.tech/task/upgrade-riddl-<VERSION>.md |
| 135 | + ../riddl-mcp-server/task/upgrade-riddl-<VERSION>.md |
| 136 | + ../riddl-models/task/upgrade-riddl-<VERSION>.md |
| 137 | + ../ossum.ai/task/upgrade-riddl-<VERSION>.md |
| 138 | + ../riddl-gen/task/upgrade-riddl-<VERSION>.md |
| 139 | + ``` |
| 140 | +
|
| 141 | + Also update the `riddl dep` column in |
| 142 | + `../CLAUDE.md` (ossuminc-level) to reflect `<VERSION>`. |
| 143 | +
|
| 144 | +## If Something Fails |
| 145 | +
|
| 146 | +- If tests fail in step 9: delete the local tag |
| 147 | + (`git tag -d <VERSION>`), fix, and restart from step 6. |
| 148 | + Do NOT push a broken tag. |
| 149 | +- If dynver shows a suffix in step 8: delete the tag, fix |
| 150 | + the dirty tree, and re-tag. |
| 151 | +- If tag push fails in step 10: check if tag exists |
| 152 | + remotely. |
| 153 | +- If publish fails in step 9: check credentials and retry |
| 154 | + (tag is still local, safe to retry). |
| 155 | +- If `gh release create` fails in step 11: the tag is |
| 156 | + already pushed, so the release can be created manually |
| 157 | + or retried. |
| 158 | +- **Never force-push tags** without explicit user approval. |
0 commit comments