diff options
| -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)" |
