|
63 | 63 | @echo "" |
64 | 64 | @echo "End-to-end:" |
65 | 65 | @echo " ci Lint + tests + examples-build (CI gate)" |
| 66 | + @echo "" |
| 67 | + @echo "Release (version bump + tag locally; CI publishes on tag push):" |
| 68 | + @echo " release-dry Preview the release (no changes)" |
| 69 | + @echo " release-version Set the version everywhere (no commit/tag)" |
| 70 | + @echo " release Bump + commit + tag (then: git push origin vX.Y.Z)" |
| 71 | + @echo " publish-dry Local packaging dry-run (mirrors CI dry-run)" |
| 72 | + @echo " Pass LEVEL=alpha|patch|minor|major|rc|release or VERSION=X.Y.Z" |
66 | 73 |
|
67 | 74 | # ============================================================================= |
68 | 75 | # Build |
@@ -253,3 +260,56 @@ examples-run: examples-build |
253 | 260 | .PHONY: ci |
254 | 261 | ci: lint test examples-build |
255 | 262 | @echo "✅ CI gate passed (lint + tests + examples)" |
| 263 | + |
| 264 | +# ============================================================================= |
| 265 | +# Release |
| 266 | +# ============================================================================= |
| 267 | +# |
| 268 | +# This workspace versions and releases every publishable crate together. The |
| 269 | +# version lives in ONE place — `[workspace.package] version` plus the |
| 270 | +# `[workspace.dependencies]` table in the root Cargo.toml — and cargo-release |
| 271 | +# keeps both in sync. Config (shared-version, tag name, publish=false) lives in |
| 272 | +# release.toml; the actual crates.io publish runs in CI on the pushed tag. |
| 273 | +# |
| 274 | +# Bump level (LEVEL) or explicit VERSION: |
| 275 | +# make release-dry # preview, no changes (default LEVEL=alpha) |
| 276 | +# make release LEVEL=patch # 0.2.0 -> 0.2.1 |
| 277 | +# make release VERSION=0.2.0 # drop the pre-release suffix |
| 278 | +# git push origin "v$(...)" # push the tag to let CI publish |
| 279 | + |
| 280 | +LEVEL ?= alpha |
| 281 | +VERSION ?= |
| 282 | +# Explicit VERSION wins over LEVEL when set. |
| 283 | +RELEASE_ARG = $(if $(VERSION),$(VERSION),$(LEVEL)) |
| 284 | + |
| 285 | +.PHONY: release-tool |
| 286 | +release-tool: |
| 287 | + @command -v cargo-release >/dev/null 2>&1 || $(CARGO) install cargo-release --locked |
| 288 | + |
| 289 | +# Preview only — cargo-release makes NO changes without --execute. |
| 290 | +.PHONY: release-dry |
| 291 | +release-dry: release-tool |
| 292 | + @$(CARGO) release $(RELEASE_ARG) --workspace |
| 293 | + |
| 294 | +# Rewrite the version in [workspace.package] + [workspace.dependencies] only; |
| 295 | +# no commit, no tag. Useful for a manual, reviewed bump. |
| 296 | +.PHONY: release-version |
| 297 | +release-version: release-tool |
| 298 | + @$(CARGO) release version $(RELEASE_ARG) --workspace --execute --no-confirm |
| 299 | + |
| 300 | +# Bump + commit + tag, then stop. --no-publish/--no-push enforce the |
| 301 | +# "CI publishes on tag push" model at the CLI level too (release.toml already |
| 302 | +# sets publish=false/push=false; this makes the guarantee not depend on config |
| 303 | +# parsing). Afterwards: `git push origin vX.Y.Z` to trigger the CI publish. |
| 304 | +.PHONY: release |
| 305 | +release: release-tool |
| 306 | + @$(CARGO) release $(RELEASE_ARG) --workspace --no-publish --no-push --execute |
| 307 | + |
| 308 | +# Build + verify a .crate for every crates.io-published member without |
| 309 | +# uploading — the same check the release workflow's dry-run runs. The two |
| 310 | +# `publish = false` FFI crates are excluded (cpex-ffi ships as signed prebuilt |
| 311 | +# artifacts; cpex-demo-ffi is an example). CI runs this on a clean checkout; |
| 312 | +# --allow-dirty lets you run it locally with work in progress. |
| 313 | +.PHONY: publish-dry |
| 314 | +publish-dry: |
| 315 | + @$(CARGO) package --workspace --locked --allow-dirty --exclude cpex-ffi --exclude cpex-demo-ffi |
0 commit comments