Skip to content

Commit

Permalink
add release script
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed May 7, 2019
1 parent d8796b5 commit eb06ed3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/deploy
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eb06ed3

Please sign in to comment.