Created
March 22, 2018 11:08
-
-
Save everm1nd/50bc8e92911dec5d4fa2d609a6493be4 to your computer and use it in GitHub Desktop.
Tag New Package Release on Travis Build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will create a git-tag if version in package.json changes | |
git config --global user.email "[email protected]" | |
git config --global user.name "Travis CI" | |
VERSION=$(node -pe "require('./package.json').version") | |
export PACKAGE_VERSION="v${VERSION}" | |
export LAST_TAG=$(git tag --sort version:refname | tail -1) | |
echo "Package version is:" $PACKAGE_VERSION | |
echo "Last tag is:" $LAST_TAG | |
if [ $PACKAGE_VERSION != $LAST_TAG ] | |
then | |
echo Tagging release... | |
git tag $PACKAGE_VERSION -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER" | |
git push --tags | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment