forked from alphagov/govuk-prototype-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-release.sh
executable file
·42 lines (35 loc) · 1.23 KB
/
create-release.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -e
# Check for the TRAVIS environment variable
if [[ -z "${TRAVIS}" ]]; then
echo "⛔️ Refusing to run outside of Travis..."
exit 1
fi
# Configure git...
git config --global user.name "Travis CI"
git config --global user.email "[email protected]"
git remote add origin_ssh [email protected]:alphagov/govuk-prototype-kit.git
# Decrypt deploy key.
#
# See `.travis/README.md` for more details
openssl aes-256-cbc -d -k $DEPLOY_KEY \
-in .travis/prototype-kit-deploy-key.enc \
-out ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# Get the version from the version file
VERSION_TAG="v`cat VERSION.txt`"
# Check that there's not a tag for the current version already
if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then
# Create a new tag and push to GitHub.
#
# GitHub will automatically create a release for the tag, ignoring any files
# specified in the .gitattributes file
echo "🏷 Creating new tag: $VERSION_TAG"
git tag $VERSION_TAG
git push origin_ssh $VERSION_TAG
# Force push the latest-release branch to this commit
echo "💨 Pushing latest-release branch to GitHub"
git push --force origin_ssh master:latest-release
else
echo "😴 Current version already exists as a tag on GitHub. Nothing to do."
fi