Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Travis to check if the version number matches the tag number #296

Merged
merged 1 commit into from
Oct 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions update-release-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ set -ex
if [ "$TRAVIS_REPO_SLUG" == "alphagov/govuk_prototype_kit" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
# get the version from the version file
VERSION_TAG="$(cat VERSION.txt)"
echo "Using the most recent tag: $VERSION_TAG and creating a latest-release branch"
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
set +x
git remote add deploy-latest-release https://"${GH_TOKEN}"@github.com/alphagov/govuk_prototype_kit.git > /dev/null 2>&1
set -x
# check the remote has been added
git checkout -b latest-release v"$VERSION_TAG"
git push --force deploy-latest-release latest-release
echo "Pushed latest-release branch to GitHub"
# check to make sure the tag doesn't already exist
if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then
echo "Using the most recent tag: $VERSION_TAG and creating a latest-release branch"
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
set +x
git remote add deploy-latest-release https://"${GH_TOKEN}"@github.com/alphagov/govuk_prototype_kit.git > /dev/null 2>&1
set -x
# check the remote has been added
git checkout -b latest-release v"$VERSION_TAG"
git push --force deploy-latest-release latest-release
echo "Pushed latest-release branch to GitHub"
else
echo "Not updating the latest-release branch as the tag already exists..."
fi
else
echo "Not updating the latest-release branch as we're on a branch..."
fi