-
Notifications
You must be signed in to change notification settings - Fork 187
/
set_tags.sh
26 lines (20 loc) · 736 Bytes
/
set_tags.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
BRANCH="master"
# Are we on the right branch?
if [ "$TRAVIS_BRANCH" = "$BRANCH" ]; then
# Is this not a Pull Request?
if [ "$TRAVIS_PULL_REQUEST" = false ]; then
# Is this not a build which was triggered by setting a new tag?
if [ -z "$TRAVIS_TAG" ]; then
echo -e "Starting to tag commit.\n"
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
git config --global user.email "[email protected]"
git config --global user.name "Travis"
# Add tag and push to master.
git tag -a v${PACKAGE_VERSION} -m "Travis build $PACKAGE_VERSION pushed a tag."
git push origin --tags
git fetch origin
echo -e "Done magic with tags.\n"
fi
fi
fi