Skip to content

Commit

Permalink
Improve the build and push scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
brendandburns committed Feb 8, 2019
1 parent cc4748f commit b8a2272
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build-package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

. ./pre-check.sh

tsc
npm pack
24 changes: 24 additions & 0 deletions pre-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

branch=$(git rev-parse --abbrev-ref HEAD)

if [[ "${branch}" != "master" ]]; then
echo "This script can only be run on the master branch. Current branch is ${branch}"
exit 1
fi

if ! git diff --quiet; then
echo "This script must only run on a clean master branch."
echo
git status
exit 1
fi

untracked=$(git ls-files --exclude-standard --others)

if [[ "${untracked}" != "" ]]; then
echo "This script requires no untracked files."
echo
git status
exit 1
fi
2 changes: 2 additions & 0 deletions push-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ if [[ "${1}x" == "x" ]]; then
exit 1
fi

. ./pre-check.sh

git tag ${1}
git push upstream ${tag}

Expand Down

0 comments on commit b8a2272

Please sign in to comment.