forked from dagrejs/dagre-d3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·66 lines (52 loc) · 1.5 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
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
# Fail on error
set -e
[ -n "$DEBUG"] && set -x
bail() {
echo $1 >&2
exit 1
}
# Initial config
PROJECT=dagre-d3
PROJECT_ROOT=`pwd`
DOC_DIR=/tmp/dagre-d3-doc
DIST_DIR=dist
# Check version. Is this a release? If not abort
VERSION=$(node src/release/check-version.js)
echo Attemping to publish version: $VERSION
# Preflight checks
[ -z "`git tag -l v$VERSION`"] || bail "Version already published. Skipping publish."
[ "`git rev-parse HEAD`" = "`git rev-parse master`" ] || bail "ERROR: You must release from the master branch"
[ -z "`git status --porcelain`" ] || bail "ERROR: Dirty index on working tree. Use git status to check"
# Pull remote repos
rm -rf $DOC_DIR
git clone git@github.com:cpettitt/cpettitt.github.com.git $DOC_DIR
# Publish docs
echo Preparing to publish docs
cd $DOC_DIR
mkdir -p project/$PROJECT
TARGET=project/$PROJECT/latest
git rm -r $TARGET || true
cp -r $PROJECT_ROOT/$DIST_DIR $TARGET
git add $TARGET
TARGET=project/$PROJECT/v$VERSION
cp -r $PROJECT_ROOT/$DIST_DIR $TARGET
git add $TARGET
git commit -m "Publish docs for $PROJECT v$VERSION"
git push origin
cd $PROJECT_ROOT
echo Done with docs
# Publish tag
git tag v$VERSION
git push origin
git push origin v$VERSION
echo Published dagre-d3 v$VERSION
# Publish to npm
npm publish
echo Published to npm
# Update patch level version + commit
node src/release/bump-version.js
make lib/version.js
git commit package.json lib/version.js -m "Bump version and set as pre-release"
git push origin
echo Updated patch version
echo Release complete!