forked from mattallty/Caporal.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
executable file
·35 lines (33 loc) · 1.11 KB
/
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
35
#!/usr/bin/env bash
###############################################
#
# Usage
#
# ./release.sh `patch`/`minor`/`major`/`<version>`
#
# defaults to conventional-recommended-bump
#
###############################################
np() {
travis status --no-interactive &&
./node_modules/.bin/trash node_modules &>/dev/null;
git pull --rebase &&
cp package-lock.json _package-lock.json &&
npm install &&
npm test &&
cp package.json _package.json &&
preset=`./node_modules/.bin/conventional-commits-detector` &&
echo $preset &&
bump=`./node_modules/.bin/conventional-recommended-bump -p angular` &&
echo ${1:-$bump} &&
npm --no-git-tag-version version ${1:-$bump} &>/dev/null &&
./node_modules/.bin/conventional-changelog -i CHANGELOG.md -s -p ${2:-$preset} &&
git add CHANGELOG.md &&
version=`cat package.json | ./node_modules/.bin/json version` &&
git commit -m"docs(CHANGELOG): $version" &&
mv -f _package.json package.json &&
mv -f _package-lock.json package-lock.json &&
npm version ${1:-$bump} -m "chore(release): %s" &&
git push --follow-tags
}
np $@