diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-02-02 17:26:52 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-02-07 09:48:25 +0100 |
| commit | 99e2964316733a3187d002555f8ee78b54b0d09e (patch) | |
| tree | 5f5cc840a9f90cf26a3a550ea887c3a30b54eeb3 | |
| parent | 8e24ba1ec8e8b4c9792e6b48a4b020a32e8c9b37 (diff) | |
| download | mullvadvpn-99e2964316733a3187d002555f8ee78b54b0d09e.tar.xz mullvadvpn-99e2964316733a3187d002555f8ee78b54b0d09e.zip | |
Add prepare_release.sh helper script
| -rwxr-xr-x | prepare_release.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/prepare_release.sh b/prepare_release.sh new file mode 100755 index 0000000000..f75732b228 --- /dev/null +++ b/prepare_release.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# This script prepares for a release. Run it with the release version as the first argument and it +# will update version numbers, commit and add a signed tag. + +set -eu + +if [[ "$#" != "1" ]]; then + echo "Please give the release version as the first and only argument to this script." + echo "For example: '2018.1-beta3' for a beta release, or '2018.6' for a stable one." + exit 1 +fi +VERSION=$1 + +if [[ $(echo $VERSION | egrep '^[0-9]{4}\.[0-9]+(-(beta|alpha)[0-9]+)?$') == "" ]]; then + echo "Invalid version format. Please specify version as:" + echo "<YEAR>.<NUMBER>[-(beta|alpha)<NUMBER>]" + exit 1 +fi + +if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then + echo "Dirty working directory! Will not accept that for an official release." + exit 1 +fi + +if [[ $(grep $VERSION CHANGELOG.md) == "" ]]; then + echo "It looks like you did not add $VERSION to the changelog?" + echo "Please make sure the changelog is up to date and correct before you proceed." + exit 1 +fi + +echo "Updating version in package.json..." +SEMVER_VERSION=`echo $VERSION | sed -re 's/($|-.*)/.0\1/g'` +sed -i -re "s/\"version\": \"[^\"]+\",/\"version\": \"$SEMVER_VERSION\",/g" package.json + +echo "Commiting package.json change to git..." +git commit -S package.json -m "Updating version in package.json" + +echo "Tagging current git commit with release tag $VERSION..." +git tag -s $VERSION -m $VERSION + + +echo "===================================================" +echo "DONE preparing for a release! Now do the following:" +echo " 1. Push the commit and tag created by this script" +echo " after you have verified they are correct" +echo " $ git push" +echo " $ git push origin $VERSION" +echo " 2. On each platform where you want to create a" +echo " release artifact, check out the tag and build:" +echo " $ git fetch" +echo " $ git checkout $VERSION" +echo " $ ./build.sh" +echo "===================================================" |
