diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-17 16:21:02 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-17 16:21:02 +0200 |
| commit | f2a0660a9b60b70af32f1157dc78cdfcb298c9f7 (patch) | |
| tree | abbb30e60a0cb037e23c392cee8ac8e712a89e96 | |
| parent | cc6655134e155dd0879ecb8eb009271e17488834 (diff) | |
| download | colitur-f2a0660a9b60b70af32f1157dc78cdfcb298c9f7.tar.gz colitur-f2a0660a9b60b70af32f1157dc78cdfcb298c9f7.zip | |
fix(make): release must not abort when the version bump is a no-opv0.1.0
Cutting a version whose files already carry it -- which is how the first
tag went, and what any re-run after a failed gate looks like -- leaves
nothing staged, and git commit aborts the target on "nothing to commit"
despite everything being in order. The commit is now conditional on
something actually being staged, and an existing tag is refused
explicitly rather than surfacing as a bare git error.
| -rw-r--r-- | Makefile | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -73,7 +73,14 @@ release: ## cut a release: make release VERSION=0.1.0 (add its CHANGELOG line f $(MAKE) check @test "$$($(DUNE) dune exec --no-build colitur -- --version)" = "$(VERSION)" || \ { echo "the built binary does not report $(VERSION)" >&2; exit 2; } - git add dune-project colitur.opam bin/main.ml CHANGELOG.md - git commit -m "release: v$(VERSION)" + @git add dune-project colitur.opam bin/main.ml CHANGELOG.md + @# Only commit if the bump actually changed something. Re-running release + @# after a failed gate -- or cutting a version whose files are already + @# correct, which is exactly how the first tag went -- leaves nothing + @# staged, and `git commit` would abort the whole target on "nothing to + @# commit" despite everything being in order. + @git diff --cached --quiet || git commit -m "release: v$(VERSION)" + @git rev-parse -q --verify "refs/tags/v$(VERSION)" >/dev/null && \ + { echo "tag v$(VERSION) already exists; delete it first to re-cut" >&2; exit 2; } || true git tag -a "v$(VERSION)" -m "colitur $(VERSION)" @echo "tagged v$(VERSION). publish with: git push origin main v$(VERSION)" |
