Skip to content

Commit e79e42b

Browse files
committed
build(make): add 'tag' target to tag + push all 3 release tag namespaces
make tag VERSION=X.Y.Z creates and pushes v<version>, go/cpex/v<version>, and <version>. Validates VERSION is semver and fails before any git command on a bad or missing value. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 6f0b8b6 commit e79e42b

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ help:
7070
@echo " release Bump + commit + tag (then: git push origin vX.Y.Z)"
7171
@echo " publish-dry Local packaging dry-run (mirrors CI dry-run)"
7272
@echo " Pass LEVEL=alpha|patch|minor|major|rc|release or VERSION=X.Y.Z"
73+
@echo " tag Tag + push all 3 release tags: make tag VERSION=X.Y.Z"
7374

7475
# =============================================================================
7576
# Build
@@ -313,3 +314,21 @@ release: release-tool
313314
.PHONY: publish-dry
314315
publish-dry:
315316
@$(CARGO) package --workspace --locked --allow-dirty --exclude cpex-ffi --exclude cpex-demo-ffi
317+
318+
# Tag the current commit across the three namespaces the project releases on,
319+
# then push all three. The `v<version>` tag is what the CI release workflow
320+
# triggers on; `go/cpex/v<version>` is the Go module tag; the bare `<version>`
321+
# is the crates.io-style tag. VERSION must be semver (e.g. 0.2.0 or
322+
# 0.2.0-alpha.5), with no leading `v`.
323+
# make tag VERSION=0.2.0-alpha.5
324+
.PHONY: tag
325+
tag:
326+
@test -n "$(VERSION)" || { echo "usage: make tag VERSION=X.Y.Z[-prerelease]"; exit 1; }
327+
@echo "$(VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$$' \
328+
|| { echo "error: VERSION '$(VERSION)' is not semver (e.g. 0.2.0 or 0.2.0-alpha.5; no leading 'v')"; exit 1; }
329+
git tag v$(VERSION)
330+
git tag go/cpex/v$(VERSION)
331+
git tag $(VERSION)
332+
git push origin v$(VERSION)
333+
git push origin go/cpex/v$(VERSION)
334+
git push origin $(VERSION)

0 commit comments

Comments
 (0)