-
Notifications
You must be signed in to change notification settings - Fork 32
/
release.sh
34 lines (23 loc) · 698 Bytes
/
release.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
#!/usr/bin/env bash
set -e
if [[ $# -eq 0 ]] ; then
echo 'version not provided: "./release.sh <VERSION>"'
exit 1
fi
NEW_VERSION=$1
BRANCH_NAME=prepare-version-${NEW_VERSION}
echo " -- preparing master branch"
git fetch
git checkout master
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]; then
echo "there are uncommitted changes in tracked files"
exit 1
fi
git pull origin master
echo " -- updating version"
npm version --no-git-tag-version ${NEW_VERSION}
git commit package.json package-lock.json -m "updated version to ${NEW_VERSION}"
git push origin master
echo " -- creating github release"
hub release create ${NEW_VERSION} -m "${NEW_VERSION}"
echo "Done."