-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·52 lines (40 loc) · 1.26 KB
/
publish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# note: realpath isn't always installed, so use pwd in subshell instead
script_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" || exit 1
cd "$script_dir" || exit 1
# there's a lot to fix
#step="eslint"
#docker build . --progress plain --pull --target eslint || { echo "$step failed"; exit 1; }
step="circular-dependency-check"
docker build . --pull --target circular-dependency-check || { echo "$step failed"; exit 1; }
git diff-index --quiet HEAD --
has_changes=$?
if [ $has_changes == 1 ]; then
echo "Must commit all changes before publishing"
exit 1
fi
# bump the version for npm
echo "What type of update is this?"
echo "Options are: A/1 (major), I/2 (minor), P/3 (patch)"
read -p "Type: " -n 1 -r
echo ''
version=
if [[ $REPLY =~ ^[Aa1]$ ]]; then
version=$(npm version major)
elif [[ $REPLY =~ ^[Ii2]$ ]]; then
version=$(npm version minor)
elif [[ $REPLY =~ ^[Pp3]$ ]]; then
version=$(npm version patch)
else
echo "Invalid option provided as update type. Valid options are: A, I, P."
exit 1
fi
if [ -z "$version" ]; then
echo "Failed to update version."
exit 1
fi
git push \
|| { echo "git push failed"; exit 1; }
npm publish --access public \
|| { echo "publish failed"; exit 1; }
echo "Successfully published config-builder $version"