|
1
|
.PHONY: help patch minor major custom release release-commit tag sync-version relock verify lint-publish |
|
2
|
|
|
3
|
SYNC := python3 scripts/sync-release-version.py |
|
4
|
VERSION = $(shell $(SYNC) --print) |
|
5
|
|
|
6
|
# Branch the tag must live on. Unlike smbcloud-cli (which tags development), |
|
7
|
# onde requires the tag to point at a commit on main that carries every |
|
8
|
# workflow file — see .agents/skills/sdk-releases/SKILL.md. |
|
9
|
RELEASE_BRANCH := main |
|
10
|
|
|
11
|
help: |
|
12
|
@echo "Release commands:" |
|
13
|
@echo " make patch # 1.2.2 -> 1.2.3" |
|
14
|
@echo " make minor # 1.2.2 -> 1.3.0" |
|
15
|
@echo " make major # 1.2.2 -> 2.0.0" |
|
16
|
@echo " make custom VERSION=1.3.0" |
|
17
|
@echo "" |
|
18
|
@echo " ...then fill in the CHANGELOG stubs and:" |
|
19
|
@echo " make release-commit # verify + commit the bump" |
|
20
|
@echo " make tag # on $(RELEASE_BRANCH), after merging" |
|
21
|
@echo "" |
|
22
|
@echo "Utilities:" |
|
23
|
@echo " make verify # check every version source agrees" |
|
24
|
@echo " make lint-publish # check Cargo.toml has no git deps" |
|
25
|
@echo " make sync-version # re-propagate the current version" |
|
26
|
@echo " make relock # re-resolve lockfiles (only when deps change)" |
|
27
|
|
|
28
|
release: |
|
29
|
@test -n "$(BUMP)" || (echo "BUMP is required" && exit 1) |
|
30
|
@if [ "$(BUMP)" = "custom" ] && [ -z "$(VERSION_ARG)" ]; then \ |
|
31
|
echo "VERSION is required for custom releases"; exit 1; \ |
|
32
|
fi |
|
33
|
@case "$$(git branch --show-current)" in \ |
|
34
|
development|release/*) ;; \ |
|
35
|
*) echo "Releases must be prepared on development or release/*"; exit 1;; \ |
|
36
|
esac |
|
37
|
@if [ -n "$$(git status --short --untracked-files=all)" ]; then \ |
|
38
|
echo "Working tree must be clean before preparing a release"; exit 1; \ |
|
39
|
fi |
|
40
|
@if [ "$(BUMP)" = "custom" ]; then \ |
|
41
|
$(SYNC) --set "$(VERSION_ARG)"; \ |
|
42
|
else \ |
|
43
|
$(SYNC) --bump "$(BUMP)"; \ |
|
44
|
fi |
|
45
|
@echo "" |
|
46
|
@echo "Version bumped to $$($(SYNC) --print)." |
|
47
|
@echo "Next: describe the release in the CHANGELOG stubs, then 'make release-commit'." |
|
48
|
|
|
49
|
patch: |
|
50
|
@$(MAKE) --no-print-directory release BUMP=patch |
|
51
|
|
|
52
|
minor: |
|
53
|
@$(MAKE) --no-print-directory release BUMP=minor |
|
54
|
|
|
55
|
major: |
|
56
|
@$(MAKE) --no-print-directory release BUMP=major |
|
57
|
|
|
58
|
custom: |
|
59
|
@$(MAKE) --no-print-directory release BUMP=custom VERSION_ARG="$(VERSION)" |
|
60
|
|
|
61
|
release-commit: verify |
|
62
|
@release_version="$$($(SYNC) --print)"; \ |
|
63
|
git add -A; \ |
|
64
|
git commit -m "$$release_version"; \ |
|
65
|
echo ""; \ |
|
66
|
echo "Committed $$release_version."; \ |
|
67
|
echo "Next: git checkout $(RELEASE_BRANCH) && git merge development --no-ff --no-edit && make tag" |
|
68
|
|
|
69
|
tag: verify |
|
70
|
@current="$$(git branch --show-current)"; \ |
|
71
|
if [ "$$current" != "$(RELEASE_BRANCH)" ]; then \ |
|
72
|
echo "Tag must be cut on $(RELEASE_BRANCH), currently on $$current"; exit 1; \ |
|
73
|
fi |
|
74
|
@if [ -n "$$(git status --short --untracked-files=all)" ]; then \ |
|
75
|
echo "Working tree must be clean before tagging"; exit 1; \ |
|
76
|
fi |
|
77
|
@release_version="$$($(SYNC) --print)"; \ |
|
78
|
if git rev-parse -q --verify "refs/tags/$$release_version" >/dev/null; then \ |
|
79
|
echo "Tag $$release_version already exists — registries are immutable, bump instead"; \ |
|
80
|
exit 1; \ |
|
81
|
fi; \ |
|
82
|
git tag "$$release_version"; \ |
|
83
|
echo "Tagged $$release_version (bare semver — a 'v' prefix will not trigger CI)."; \ |
|
84
|
echo "Next: git push <remote> development $(RELEASE_BRANCH) $$release_version" |
|
85
|
|
|
86
|
sync-version: |
|
87
|
@$(SYNC) |
|
88
|
|
|
89
|
verify: |
|
90
|
@$(SYNC) --check |
|
91
|
|
|
92
|
lint-publish: |
|
93
|
@$(SYNC) --lint-publish |
|
94
|
|
|
95
|
# A version bump patches the lockfile version strings in-process, so it needs |
|
96
|
# no cargo and no network. Use this only when dependencies actually changed: |
|
97
|
# cargo metadata re-resolves (no compile, unlike `cargo check`), but each |
|
98
|
# manifest costs ~72s of network because the [patch.crates-io] sysctl git |
|
99
|
# dependency is refetched on every resolve. |
|
100
|
relock: |
|
101
|
@echo "Re-resolving lockfiles (network-bound, ~3min)..." |
|
102
|
@cargo metadata --format-version 1 --quiet >/dev/null |
|
103
|
@cargo metadata --format-version 1 --quiet \ |
|
104
|
--manifest-path sdk/dart/rust/Cargo.toml >/dev/null |
|
105
|
@cargo metadata --format-version 1 --quiet \ |
|
106
|
--manifest-path sdk/react-native/rust/Cargo.toml >/dev/null |
|
107
|
@echo " Cargo.lock, sdk/dart/rust/Cargo.lock, sdk/react-native/rust/Cargo.lock" |