-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |