Skip to content

Commit 24797b3

Browse files
committed
pre-push: only push signed tags
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cdb2366 commit 24797b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pre-push.hook

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ die () {
99
exit 1
1010
}
1111

12+
LF='
13+
'
14+
1215
git diff --no-index --quiet pre-push.hook "$(git rev-parse --git-path hooks/pre-push)" ||
1316
die 'The `pre-push` hook is not up to date with `pre-push.hook`'
1417

1518
# Verify that any tagged version is reflected in its `package.json`
1619
for tag in $(git for-each-ref --format='%(refname:short)' --points-at=HEAD 'refs/tags/v[0-9]*')
1720
do
21+
out="$(git tag --verify $tag 2>&1)" ||
22+
die "$out$LF${LF}Tag $tag is not signed/signature cannot be verified"
23+
1824
git grep -q '"version": "'"${tag#v}"'"' refs/tags/$tag -- package.json || {
1925
sed 's/\("version": "\)[^"]*/\1'"${tag#v}"/ <package.json >package.json.new &&
2026
mv -f package.json.new package.json

0 commit comments

Comments
 (0)