Skip to content

Commit 77e9348

Browse files
authored
Merge pull request #47 from dscho/ensure-correct-version-in-package.json
Ensure correct version in package.json
2 parents 555b57a + 3b4b546 commit 77e9348

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-git-for-windows-sdk",
3-
"version": "0.0.0",
3+
"version": "0.0.9",
44
"private": true,
55
"description": "Set up an environment to develop Git for WindowsTypeScript template action",
66
"main": "lib/main.js",

pre-push.hook

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,26 @@ 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

18+
# Verify that any tagged version is reflected in its `package.json`
19+
for tag in $(git for-each-ref --format='%(refname:short)' --points-at=HEAD 'refs/tags/v[0-9]*')
20+
do
21+
out="$(git tag --verify $tag 2>&1)" ||
22+
die "$out$LF${LF}Tag $tag is not signed/signature cannot be verified"
23+
24+
git grep -q '"version": "'"${tag#v}"'"' refs/tags/$tag -- package.json || {
25+
sed 's/\("version": "\)[^"]*/\1'"${tag#v}"/ <package.json >package.json.new &&
26+
mv -f package.json.new package.json
27+
die "package.json did not reflect $tag; It was adjusted."
28+
exit 1
29+
}
30+
done
31+
1532
git diff --quiet dist/ ||
1633
die '`dist/` is dirty'
1734

0 commit comments

Comments
 (0)