@@ -44,12 +44,43 @@ tasks:
44
44
build :
45
45
desc : Build the terravalet executable.
46
46
cmds :
47
+ - task : check-tags
47
48
- go build -o bin/terravalet -v -ldflags="{{.LDFLAGS}}" .
48
49
vars : &build-vars
49
50
FULL_VERSION :
50
51
sh : git describe --long --dirty --always
51
52
LDFLAGS : -w -s -X main.fullVersion={{.FULL_VERSION}}
52
53
54
+ check-tags :
55
+ # A lightweight tags is listed as "commit" in the output of "git for-each-ref 'refs/tags".
56
+ # If we find at least one, we fail the build.
57
+ # To replace a lightweight tag with an annotated:
58
+ # 1. Checkout the lightweight tag
59
+ # git checkout <tag>
60
+ # 2. Look up the date and committer
61
+ # git log
62
+ # 3. Replace the lightweight tag with an annotated one, with the same date and author
63
+ # GIT_COMMITTER_DATE="2021-01-31 00:00" \
64
+ # git tag --force --annotate <tag> -m 'Release <tag>'
65
+ # 4. If the lightweight tag has also been pushed to the remote, it can become a mess
66
+ # quickly, because it will force everybody to be informed and re-fetch the modified
67
+ # tags.
68
+ # 4.1 Force push the rewritten tag
69
+ # git push --force origin <tag>
70
+ # 4.2 Inform everybody who cloned the repo to perform the following:
71
+ # git tag -d <tag>
72
+ # git fetch origin tag <tag>
73
+ # 5. Go back to the HEAD of the branch
74
+ # git checkout master
75
+ desc : Check if the repo contains lightweight git tags beginning with "v".
76
+ cmds :
77
+ - if test -n "$WRONG_TAGS"; then echo $HEADER; echo "$WRONG_TAGS"; echo $MSG; exit 1; fi
78
+ env :
79
+ WRONG_TAGS :
80
+ sh : " (git for-each-ref 'refs/tags/v*' | fgrep commit) || exit 0"
81
+ HEADER : " Error: this repo contains the following lightweight git tags beginning with v (so meant to be release tags):"
82
+ MSG : Release tags should be annotated. Read the Taskfile for how to fix.
83
+
53
84
#
54
85
# usage: env RELEASE_TAG=v0.1.0 gopass task release
55
86
#
@@ -69,7 +100,7 @@ tasks:
69
100
# before building the executables, so that we can embed this information
70
101
# in the binaries.
71
102
# To recover: delete local tag: git tag --delete tagname
72
- - git tag -a {{.RELEASE_TAG}} -m ''
103
+ - git tag --annotate {{.RELEASE_TAG}} -m 'Release {{.RELEASE_TAG}} '
73
104
- task : release-linux
74
105
- task : release-darwin
75
106
# - task: system-test
0 commit comments