From eb06ed3e68a3ca9a905f41e3fd6a78af376e8122 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Tue, 7 May 2019 20:45:25 +0200 Subject: [PATCH] add release script --- scripts/deploy | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 scripts/deploy diff --git a/scripts/deploy b/scripts/deploy new file mode 100755 index 0000000..67a9d3c --- /dev/null +++ b/scripts/deploy @@ -0,0 +1,33 @@ +#!/bin/bash + +function untag () { + git tag -d $1 + git push origin --delete $1 +} + +## Verify nothing is unstaged or untracked +status=$(git status -s) +if [ -n "$status" ]; then + echo "branch isn't clean: commit staged files and / or discard untracked files!" + echo $status + exit 1 +fi + +## Verify code compiles +echo "compiling library" && elm make || exit 1 +rm -f index.html + +## Get version number +version=$(cat elm.json | grep '"version"' | sed 's/\([^0-9]*\)\([0-9]\.[0-9]\.[0-9]\)\(.*\)/\2/') +if [ -z "$version" ]; then + echo "unable to capture package version" + exit 1 +else + echo "VERSION: $version" +fi + +## Create tag and publish +trap 'untag $version' 1 +git tag -d $version 1>/dev/null 2>&1 +git tag -a $version -m "release version $version" && git push origin $version +elm publish || exit 1