From 7387bdbc23088e3cb4f6525a2cc561de9b3cd4ab Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 18 Aug 2021 18:03:31 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Add=20release=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- release.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..53bbd406 --- /dev/null +++ b/release.sh @@ -0,0 +1,39 @@ +#!bin/bash + +# get current branch +branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') + +# push any local changes +git push + +# checkout stable branch (this will catch uncommitted changes) +git checkout stable || exit 1 + +# branch validation +if [ $branch = "dev" ]; then + echo "Enter the release version (eg. v1.0.0):" + read version + + echo "Started releasing $version for Congo..." + + # pull latest from stable + git pull + + # merge in changes from dev branch + git merge --no-ff dev -m "🔖 Release $version" + + # create tag + git tag $version + + # push commit and tag to remote + git push + git push --tags + + echo "$version successfully released!" + echo "Returning to dev branch..." + + git checkout dev + +else + echo "Releases can only be published from the dev branch!" +fi