Skip to content

Commit cfb04ee

Browse files
authored
Merge branch 'main' into v1.7.1-prep
2 parents f243e9b + 9ae955a commit cfb04ee

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ SHELL := bash
33

44
GIMME_GENERATE := ./gimme-generate
55

6+
TAG_VERSION ?= notset
7+
68
.PHONY: all
79
all: lint assert-copyright generate
810

@@ -19,6 +21,24 @@ lint:
1921
generate: .testdata/sample-versions.txt
2022
@true
2123

24+
.PHONY: tag
25+
tag: .assert-tag-version-defined .assert-tag-matches-source
26+
git tag -s -a -m 'Release $(TAG_VERSION)' '$(TAG_VERSION)' $(TAG_REF)
27+
28+
.PHONY: .assert-tag-version-defined
29+
.assert-tag-version-defined:
30+
ifeq ($(TAG_VERSION), notset)
31+
$(error TAG_VERSION must be set)
32+
endif
33+
34+
.PHONY: .assert-tag-matches-source
35+
.assert-tag-matches-source:
36+
@diff -u \
37+
--label a/version/gimme \
38+
<(awk 'BEGIN { FS="="; } /^readonly GIMME_VERSION/ { gsub(/"/, "", $$2); print $$2 }' gimme) \
39+
--label b/version/TAG_VERSION \
40+
<(echo '$(TAG_VERSION)')
41+
2242
$(GIMME_GENERATE): $(shell git ls-files '*.go') internal/sample-stub-header
2343
go build -o $@ ./internal/cmd/gimme-generate/
2444

0 commit comments

Comments
 (0)