Skip to content

Commit b8a2272

Browse files
committed
Improve the build and push scripts.
1 parent cc4748f commit b8a2272

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

build-package.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
22

3+
. ./pre-check.sh
4+
35
tsc
46
npm pack

pre-check.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
branch=$(git rev-parse --abbrev-ref HEAD)
4+
5+
if [[ "${branch}" != "master" ]]; then
6+
echo "This script can only be run on the master branch. Current branch is ${branch}"
7+
exit 1
8+
fi
9+
10+
if ! git diff --quiet; then
11+
echo "This script must only run on a clean master branch."
12+
echo
13+
git status
14+
exit 1
15+
fi
16+
17+
untracked=$(git ls-files --exclude-standard --others)
18+
19+
if [[ "${untracked}" != "" ]]; then
20+
echo "This script requires no untracked files."
21+
echo
22+
git status
23+
exit 1
24+
fi

push-package.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ if [[ "${1}x" == "x" ]]; then
44
exit 1
55
fi
66

7+
. ./pre-check.sh
8+
79
git tag ${1}
810
git push upstream ${tag}
911

0 commit comments

Comments
 (0)