forked from xavierraffin/inversify-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.bash
executable file
·71 lines (58 loc) · 1.99 KB
/
release.bash
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# This script should be invoked through "npm run release"
git diff-index --quiet HEAD
if [[ $? -ne 0 ]] ; then
echo "/!\\ You have local changes. Have you committed your changes first? If not, please run 'git stash --include-untracked' and retry."
exit 1
fi
if [[ "$1" == "fast" ]] ; then
echo "## FAST RELEASE MODE - USE WITH EXTREME CAUTION"
else
echo "## NORMAL RELEASE MODE - FULL CLEAN AND REBUILD"
make clean
fi
if [ `git rev-parse --abbrev-ref HEAD` != 'prod' ]
then
echo "## THIS IS A Beta RELEASE, attempting build..."
make build
if [[ $? -ne 0 ]] ; then
echo "## build failed! aborting release."
exit 1
fi
export INCREMENTED_PACKAGE_VERSION=`npm version --no-git-tag-version prerelease --preid=beta | cut -c 2-`
echo "## incremented package version: $INCREMENTED_PACKAGE_VERSION";
git add package.json package-lock.json && git commit -m "Release beta version $INCREMENTED_PACKAGE_VERSION"
if [[ $? -ne 0 ]] ; then
echo "## git add failed! aborting release."
exit 1
fi
else
echo "## THIS IS A PROD RELEASE, attempting build..."
if [[ "$1" == "fast" ]] ; then
make build
else
make build lint test
fi
if [[ $? -ne 0 ]] ; then
echo "## build failed! aborting release."
exit 1
fi
export INCREMENTED_PACKAGE_VERSION=`npm --no-git-tag-version version patch | cut -c 2-`
echo "## incremented package version: $INCREMENTED_PACKAGE_VERSION";
git add package.json package-lock.json && git commit -m "Release prod version $INCREMENTED_PACKAGE_VERSION" && git tag -a $INCREMENTED_PACKAGE_VERSION -m "Release version $INCREMENTED_PACKAGE_VERSION"
if [[ $? -ne 0 ]] ; then
echo "## git add failed! aborting release."
exit 1
fi
fi
git push --follow-tags
if [[ $? -ne 0 ]] ; then
echo "## git push failed - not publishing!"
exit 1
fi
cp package.json package-lock.json ./dist
npm publish ./dist --registry=https://npm.pkg.github.com
if [[ $? -ne 0 ]] ; then
echo "## npm publish failed!"
exit 1
fi