-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpublish
executable file
·34 lines (29 loc) · 865 Bytes
/
publish
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
#!/bin/sh
function major {
npm version major && npm publish && npm version patch && git push --tags && git push origin master
}
function minor {
npm version minor && npm publish && npm version patch && git push --tags && git push origin master
}
function patch {
npm version patch && npm publish && git push --tags && git push origin master
}
function help {
echo "$0 [<major|minor|patch>]"
echo "Publishes package to npm and git."
echo "\t1 major"
echo "\t4 minor"
echo "\t5 patch"
}
if [ "$1" == "help" ]; then
help
elif output=$(git status --untracked-files=no --porcelain) && [ -z "$output" ]; then
# Working directory clean
TIMEFORMAT="Published in %3lR"
time ${@:-patch}
else
red=`tput setaf 1`
reset=`tput sgr0`
echo "\t${red}Git working directory not clean."
echo "\tCommit your changes and try again.${reset}"
fi