|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 |
|
4 | | -REPO_PATH='alphagov/govuk-prototype-kit' |
5 | | - |
6 | | -echo "Add config for alphagov/$REPO_PATH" |
| 4 | +# Check for the TRAVIS environment variable |
| 5 | +if [[ -z "${TRAVIS}" ]]; then |
| 6 | + echo "⛔️ Refusing to run outside of Travis..." |
| 7 | + exit 1 |
| 8 | +fi |
7 | 9 |
|
| 10 | +# Configure git... |
8 | 11 | git config --global user.name "Travis CI" |
9 | 12 | git config --global user.email "travis@travis-ci.org" |
10 | | -git remote add origin_ssh git@github.com:$REPO_PATH.git |
| 13 | +git remote add origin_ssh git@github.com:alphagov/govuk-prototype-kit.git |
11 | 14 |
|
12 | | -# This openssl command was generated automatically by `travis encrypt-file`, see `.travis/README.md` for more details |
13 | | -openssl aes-256-cbc -K $encrypted_a0ab9bc5246b_key -iv $encrypted_a0ab9bc5246b_iv -in .travis/govuk_prototype_kit.enc -out ~/.ssh/id_rsa -d |
14 | | -chmod 600 ~/.ssh/id_rsa |
| 15 | +# Decrypt deploy key. |
| 16 | +# |
| 17 | +# See `.travis/README.md` for more details |
| 18 | +openssl aes-256-cbc -d -k $DEPLOY_KEY \ |
| 19 | + -in .travis/prototype-kit-deploy-key.enc \ |
| 20 | + -out ~/.ssh/id_rsa |
15 | 21 |
|
16 | | -echo "Check to see if the version file has been updated" |
| 22 | +chmod 600 ~/.ssh/id_rsa |
17 | 23 |
|
18 | 24 | # Get the version from the version file |
19 | 25 | VERSION_TAG="v`cat VERSION.txt`" |
20 | 26 |
|
21 | | -# Create a new tag - if the version file has been updated and a tag for that |
22 | | -# version doesn't already exist |
23 | | - |
24 | | -# Check to make sure the tag doesn't already exist |
| 27 | +# Check that there's not a tag for the current version already |
25 | 28 | if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then |
26 | | - echo "Creating new tag: $VERSION_TAG" |
27 | | - |
28 | | - # Create a new tag and push to Github |
| 29 | + # Create a new tag and push to GitHub. |
| 30 | + # |
| 31 | + # GitHub will automatically create a release for the tag, ignoring any files |
| 32 | + # specified in the .gitattributes file |
| 33 | + echo "🏷 Creating new tag: $VERSION_TAG" |
29 | 34 | git tag $VERSION_TAG |
30 | 35 | git push origin_ssh $VERSION_TAG |
31 | 36 |
|
32 | | - # This tag will trigger the builds for the deploy providers marked "# For tagged commits" in .travis.yml |
33 | | - |
34 | | - # Alias branch for the most recently released tag, for easier diffing |
35 | | - # Force push local `master` branch to the `latest-release` branch on Github |
| 37 | + # Force push the latest-release branch to this commit |
| 38 | + echo "💨 Pushing latest-release branch to GitHub" |
36 | 39 | git push --force origin_ssh master:latest-release |
37 | | - echo "Pushed latest-release branch to GitHub" |
38 | | - |
39 | 40 | else |
40 | | - echo "Not creating a new tag, or updating the latest-release branch as the tag already exists..." |
| 41 | + echo "😴 Current version already exists as a tag on GitHub. Nothing to do." |
41 | 42 | fi |
0 commit comments