|
1 | 1 | # Release semantic-diff |
2 | 2 |
|
3 | | -Publish a new version of semantic-diff with consistent versioning across all distribution channels: Cargo.toml, crates.io, GitHub release (with tag), and Homebrew tap. |
| 3 | +Publish a new version to crates.io, GitHub Releases, and Homebrew (via CI). |
4 | 4 |
|
5 | 5 | ## Usage |
6 | 6 |
|
7 | 7 | ``` |
8 | 8 | /release [version] |
9 | 9 | ``` |
10 | 10 |
|
11 | | -- `version` — optional, e.g. `0.4.0`. If omitted, prompt the user. |
| 11 | +If version is omitted, check current version and ask user. |
12 | 12 |
|
13 | 13 | ## Steps |
14 | 14 |
|
15 | 15 | ### 1. Determine version |
16 | 16 |
|
17 | | -If no version argument provided, check current version and ask user: |
18 | 17 | ```bash |
19 | | -cd /Users/kshum/Documents/gitproj/semantic-diff && grep '^version' Cargo.toml |
| 18 | +grep '^version' Cargo.toml |
| 19 | +git tag -l 'v*' | sort -V | tail -3 |
20 | 20 | ``` |
21 | 21 |
|
22 | | -### 2. Version consistency check (MANDATORY) |
| 22 | +### 2. Update Cargo.toml |
23 | 23 |
|
24 | | -Before making any changes, audit all version sources and report mismatches: |
| 24 | +Edit `version = "..."` to the new version. Run `cargo build` to update Cargo.lock. |
25 | 25 |
|
26 | | -```bash |
27 | | -echo "=== Cargo.toml ===" && grep '^version' Cargo.toml |
28 | | -echo "=== Git tags (local) ===" && git tag -l 'v*' | sort -V | tail -5 |
29 | | -echo "=== Git tags (remote) ===" && git ls-remote --tags origin 'refs/tags/v*' | awk '{print $2}' | sed 's|refs/tags/||' | sort -V | tail -5 |
30 | | -echo "=== GitHub releases ===" && gh release list --limit 5 |
31 | | -echo "=== crates.io ===" && cargo search semantic-diff --limit 1 2>/dev/null || echo "(unable to check)" |
32 | | -``` |
33 | | - |
34 | | -**All of these must align for the target version before the release is considered complete:** |
35 | | -- `Cargo.toml` version matches `<VERSION>` |
36 | | -- Git tag `v<VERSION>` exists locally and on remote |
37 | | -- GitHub release `v<VERSION>` exists with curated notes |
38 | | -- crates.io has `<VERSION>` published |
39 | | -- CI workflow triggered (builds binaries + updates Homebrew tap) |
40 | | - |
41 | | -If previous releases have mismatches (e.g., GitHub release exists but no git tag, or crates.io is behind), **report them to the user** and offer to fix before proceeding with the new release. |
42 | | - |
43 | | -### 3. Update Cargo.toml version |
44 | | - |
45 | | -Edit the `version = "..."` line in `Cargo.toml` to the new version. Skip if already correct. |
46 | | - |
47 | | -### 4. Add changelog entry to README (MANDATORY — must be in the release commit) |
48 | | - |
49 | | -**This step MUST happen before the commit in Step 7.** The changelog is part of the release commit, not a follow-up. |
50 | | - |
51 | | -1. Find the previous release tag: |
52 | | -```bash |
53 | | -git tag -l 'v*' | sort -V | tail -1 |
54 | | -``` |
| 26 | +### 3. Build and test |
55 | 27 |
|
56 | | -2. Get all changes since the last tag: |
57 | 28 | ```bash |
58 | | -git log --oneline <previous_tag>..HEAD |
59 | | -``` |
60 | | - |
61 | | -3. Read the `## Changelog` section in `README.md` and add a new `### v<VERSION>` entry **above** the previous version. |
62 | | - |
63 | | -4. Write human-readable bullet points grouped by theme (features, fixes, perf). Format: |
64 | | -```markdown |
65 | | -### v<VERSION> |
66 | | - |
67 | | -- **Feature name** — One-sentence description of what it does and why. |
68 | | -- **Fix** — What was broken and how it's fixed. |
| 29 | +cargo clippy -- -D warnings 2>&1 |
| 30 | +cargo build --release 2>&1 |
| 31 | +cargo test 2>&1 |
69 | 32 | ``` |
70 | 33 |
|
71 | | -5. Also update the config example block in README if any defaults or options changed. |
72 | | - |
73 | | -**The README.md changes must be staged along with Cargo.toml in Step 7's commit.** |
74 | | - |
75 | | -### 5. Verify the build |
76 | | - |
77 | | -```bash |
78 | | -cd /Users/kshum/Documents/gitproj/semantic-diff && cargo build --release 2>&1 |
79 | | -``` |
| 34 | +All must pass before proceeding. |
80 | 35 |
|
81 | | -### 6. Publish to crates.io |
| 36 | +### 4. Publish to crates.io |
82 | 37 |
|
83 | 38 | ```bash |
84 | | -cd /Users/kshum/Documents/gitproj/semantic-diff && cargo publish 2>&1 |
| 39 | +cargo publish 2>&1 |
85 | 40 | ``` |
86 | 41 |
|
87 | | -If this fails with an email verification error, tell the user to verify at https://crates.io/settings/profile. |
| 42 | +If this fails with email verification, tell user to verify at https://crates.io/settings/profile. |
88 | 43 |
|
89 | | -### 7. Commit, tag, and push |
| 44 | +### 5. Commit and push |
90 | 45 |
|
91 | | -Ensure the active `gh` account is `alankyshum`: |
| 46 | +Ensure `gh` is authenticated as `alankyshum` and remote uses HTTPS: |
92 | 47 | ```bash |
93 | 48 | gh auth status |
94 | | -``` |
95 | | - |
96 | | -If the active account is not `alankyshum`, switch: |
97 | | -```bash |
98 | | -gh auth switch --user alankyshum |
99 | | -``` |
100 | | - |
101 | | -Ensure the remote uses HTTPS (so `gh` handles auth): |
102 | | -```bash |
103 | 49 | git remote set-url origin https://github.com/alankyshum/semantic-diff.git |
104 | 50 | ``` |
105 | 51 |
|
106 | | -Commit the version bump, changelog, and any config doc updates together in a single release commit: |
107 | | -```bash |
108 | | -cd /Users/kshum/Documents/gitproj/semantic-diff && git add Cargo.toml Cargo.lock README.md && git commit -m "chore: release v<VERSION> with changelog" |
109 | | -``` |
110 | | - |
111 | | -**Verify README.md is included** — if `git diff --cached README.md` shows no changes, Step 4 was skipped. Go back and add the changelog entry before committing. |
112 | | - |
113 | | -Push to main: |
| 52 | +Commit version bump: |
114 | 53 | ```bash |
115 | | -cd /Users/kshum/Documents/gitproj/semantic-diff && git push origin main |
| 54 | +git add Cargo.toml Cargo.lock |
| 55 | +git commit -m "chore: release v<VERSION>" |
| 56 | +git push origin main |
116 | 57 | ``` |
117 | 58 |
|
118 | | -### 8. Create GitHub release with curated changelog |
| 59 | +### 6. Create GitHub release |
119 | 60 |
|
120 | | -Write release notes following this format — do NOT use `--generate-notes`: |
| 61 | +Write curated release notes from `git log --oneline <previous_tag>..HEAD`. Group by theme, not raw commits. Do NOT use `--generate-notes`. |
121 | 62 |
|
122 | 63 | ```bash |
123 | 64 | gh release create v<VERSION> --title "v<VERSION>" --notes "$(cat <<'EOF' |
124 | 65 | ## What's Changed |
125 | 66 |
|
126 | | -### <Feature Category 1> |
127 | | -- Bullet point summarizing change |
128 | | -
|
129 | | -### <Feature Category 2> |
130 | | -- Bullet point summarizing change |
131 | | -
|
132 | | -### Fixes |
133 | | -- Bullet point for any fixes |
| 67 | +- **Feature** — Description |
| 68 | +- **Fix** — Description |
134 | 69 |
|
135 | 70 | ## Install / Upgrade |
136 | 71 |
|
|
145 | 80 | )" |
146 | 81 | ``` |
147 | 82 |
|
148 | | -Group changes by theme (e.g. "Adaptive Theme", "Docs & Community", "Fixes") rather than listing raw commits. Use `git log --oneline <previous_tag>..v<VERSION>` to see all changes. Write human-readable descriptions, not commit messages. |
149 | | - |
150 | | -### 9. Post-release verification (MANDATORY) |
151 | | - |
152 | | -After GitHub release is created, verify all channels are consistent: |
153 | | - |
154 | | -```bash |
155 | | -echo "=== Verify tag ===" && git fetch --tags && git tag -l "v<VERSION>" |
156 | | -echo "=== Verify GitHub release ===" && gh release view "v<VERSION>" --json tagName,name --jq '.tagName + " " + .name' |
157 | | -echo "=== Verify crates.io ===" && cargo search semantic-diff --limit 1 |
158 | | -echo "=== Verify CI triggered ===" && gh run list --limit 1 |
159 | | -``` |
160 | | - |
161 | | -If any channel is missing or mismatched, fix it before proceeding. |
| 83 | +This creates the git tag and triggers the release CI workflow which: |
| 84 | +1. Builds `aarch64-apple-darwin` and `x86_64-apple-darwin` binaries |
| 85 | +2. Uploads them to the GitHub release |
| 86 | +3. Auto-updates the Homebrew tap at `alankyshum/homebrew-tap` |
162 | 87 |
|
163 | | -### 10. Monitor CI |
| 88 | +### 7. Verify |
164 | 89 |
|
165 | | -The release workflow (`.github/workflows/release.yml`) auto-triggers on tag push (created by `gh release create`). It will: |
166 | | -1. Build `aarch64-apple-darwin` and `x86_64-apple-darwin` binaries |
167 | | -2. Upload them to the GitHub release |
168 | | -3. Auto-update the Homebrew tap formula at `alankyshum/homebrew-tap` |
169 | | - |
170 | | -Watch the workflow: |
171 | 90 | ```bash |
172 | | -cd /Users/kshum/Documents/gitproj/semantic-diff && gh run list --limit 1 |
| 91 | +echo "=== Tag ===" && git tag -l "v<VERSION>" |
| 92 | +echo "=== GitHub release ===" && gh release view "v<VERSION>" --json tagName,name --jq '.tagName + " " + .name' |
| 93 | +echo "=== crates.io ===" && cargo search semantic-diff --limit 1 |
| 94 | +echo "=== CI ===" && gh run list --limit 1 |
173 | 95 | ``` |
174 | 96 |
|
175 | | -### 11. Report |
176 | | - |
177 | | -Print summary with links and verification status: |
178 | | -- Cargo.toml: `<VERSION>` ✓ |
179 | | -- crates.io: https://crates.io/crates/semantic-diff ✓/✗ |
180 | | -- GitHub release: https://github.com/alankyshum/semantic-diff/releases/tag/v<VERSION> ✓/✗ |
181 | | -- Git tag: `v<VERSION>` ✓/✗ |
182 | | -- CI workflow: ✓/✗ (triggered / completed) |
| 97 | +Report summary: |
| 98 | +- crates.io: https://crates.io/crates/semantic-diff |
| 99 | +- GitHub release: https://github.com/alankyshum/semantic-diff/releases/tag/v<VERSION> |
183 | 100 | - Homebrew: `brew install alankyshum/tap/semantic-diff` (updated by CI) |
184 | 101 |
|
185 | 102 | ## Prerequisites |
186 | 103 |
|
187 | 104 | - `cargo login` authenticated with crates.io |
188 | 105 | - `gh` CLI authenticated as `alankyshum` |
189 | | -- Remote URL set to HTTPS (`https://github.com/alankyshum/semantic-diff.git`) |
190 | 106 | - `HOMEBREW_TAP_TOKEN` secret set in `alankyshum/semantic-diff` repo |
0 commit comments