-
Notifications
You must be signed in to change notification settings - Fork 13
/
release
executable file
·55 lines (44 loc) · 1.33 KB
/
release
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
53
54
55
#!/bin/bash
branch=${CIRCLE_BRANCH:-$(git symbolic-ref --short -q HEAD)}
last_commit_msg=$(git log -1 --pretty=%B)
echo "Last commit: $last_commit_msg"
if [[ $last_commit_msg =~ ^Release\ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Release commit -> nothing to do (we don't publish recursively, right?). Exiting"
exit 0
fi
if [ $NPM_TOKEN ]; then
echo "\$NPM_TOKEN token found. Adding to ~/.npmrc"
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
fi
if [ $CI ]; then
echo 'Setting git CI User'
git config --global user.email "circleci@wiser.com"
git config --global user.name "CircleCI Publish"
fi
type=''
opts_preprelease=''
case $branch in
master)
type="release"
;;
*beta)
type="beta"
opts_preprelease='--preRelease=beta --npm.tag=beta'
;;
*)
echo "Feature branch. Not releasing."
exit 0
;;
esac
echo "Building *$type* branch: $branch"
# Directory must be clean before running `release-it`
git checkout .
# https://github.com/webpro/release-it
release-it $1 $2 $3 $4 $5 --verbose --force \
--beforeChangelogCommand="conventional-changelog -p angular -i CHANGELOG.md -s" \
--changelogCommand="conventional-changelog -p angular | tail -n +3" \
--no-safeBump \
--dist.beforeStageCommand="npm install" \
-n --no-require-upstream \
--src.tagName='version-%s' \
$opts_preprelease