forked from antonycourtney/node-sqlite3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_tag.sh
More file actions
executable file
·24 lines (21 loc) · 967 Bytes
/
Copy pathvalidate_tag.sh
File metadata and controls
executable file
·24 lines (21 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
set -u
# let's catch the case where we tag but
# forget to increment the package.json version
# check if we are on a tag
if [ `git describe --tags --always HEAD` ]; then
echo 'looks like we are on a tag'
if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then
echo 'git reports the same tag as travis'
# now check to make sure package.json `version` matches
MODULE_VERSION=$(node -e "console.log(require('./package.json').version)")
if [[ $MODULE_VERSION != $TRAVIS_BRANCH ]] && [[ v$MODULE_VERSION != $TRAVIS_BRANCH ]]; then
echo "package.json version ($MODULE_VERSION) does not match tag ($TRAVIS_BRANCH)"
exit 1
else
echo "Validation success: package.json ($MODULE_VERSION) matches tag ($TRAVIS_BRANCH)"
fi
else
echo "warning: travis thinks the tag ($TRAVIS_BRANCH) differs from git (`git describe --tags --always HEAD`)"
fi
fi