Skip to content

Commit 2f08d25

Browse files
committed
#391: add tagging utilities
1 parent 8ad783d commit 2f08d25

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,43 @@ dev-teardown:
318318
generate-protos: install-lint-tools
319319
@echo "Generating Protos"
320320
@buf generate
321+
322+
########################################
323+
########### RELEASE UTILITIES ##########
324+
########################################
325+
.PHONY: check-branch check-tag-message patch-release-tag new-minor-release-tag new-major-release-tag
326+
327+
check-branch:
328+
@if [ $$(git branch --show-current | tr -d '\n') != "main" ]; \
329+
then \
330+
echo >&2 "you need to be on the main branch"; \
331+
false; \
332+
fi
333+
334+
check-tag-message:
335+
@if [ -z "$(TAG_MESSAGE)" ]; \
336+
then \
337+
echo >&2 "you need to set the TAG_MESSAGE environment variable to a non empty string"; \
338+
false; \
339+
fi
340+
341+
new-patch-release-tag: SHELL:=/bin/bash
342+
new-patch-release-tag: check-branch check-tag-message
343+
$(shell \
344+
read -a number <<< $$(git tag -l | sort -Vr | head -n 1 | sed -E 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1 \2 \3/'); \
345+
git tag "v$${number[0]}.$${number[1]}.$$(($${number[2]}+1))" -m "${TAG_MESSAGE}"; \
346+
)
347+
348+
new-minor-release-tag: SHELL:=/bin/bash
349+
new-minor-release-tag: check-branch check-tag-message
350+
$(shell \
351+
read -a number <<< $$(git tag -l | sort -Vr | head -n 1 | sed -E 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1 \2 \3/'); \
352+
git tag "v$${number[0]}.$$(($${number[1]}+1)).0" -m "${TAG_MESSAGE}"; \
353+
)
354+
355+
new-major-release-tag: SHELL:=/bin/bash
356+
new-major-release-tag: check-branch check-tag-message
357+
$(shell \
358+
read -a number <<< $$(git tag -l | sort -Vr | head -n 1 | sed -E 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1 \2 \3/'); \
359+
git tag "v$$(($${number[0]}+1)).0.0" -m "${TAG_MESSAGE}"; \
360+
)

0 commit comments

Comments
 (0)