Repository navigation
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·84 lines (60 loc) · 1.54 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·84 lines (60 loc) · 1.54 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
#
# Cuts a release.
#
# - creates a <version>-release branch
# - builds the driver and the API docs
# - copies the driver into ./node and publishes it to npm as "gitana"
# - commits dist and node/lib, tags, and pushes the branch and tag
# - returns to master and deletes the local branch
#
# Bump the version first with `npm run bump`, which keeps package.json and
# node/package.json in step.
#
set -e
VERSION="$(node -p "require('./package.json').version")"
BRANCH="$VERSION-release"
echo "Releasing version $VERSION"
# refuse to start from a dirty tree - the release commit below adds everything
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo "working tree has uncommitted changes - commit or stash them first"
exit 1
fi
#
# SETUP
#
git checkout master
git checkout -b "$BRANCH"
#
# STEP 1: BUILD DRIVER AND JSDOCS
#
npm run build
npm run docs
#
# STEP 2: BUILD AND PUBLISH THE NODE PACKAGE
#
# This copies dist into node/lib, so it has to happen before the commit below -
# node/lib is tracked, unlike dist.
#
sh npmjs.sh
#
# STEP 3: COMMIT THE RELEASE
#
# dist and node/lib are gitignored build artifacts - they are committed only here,
# on the release branch, so that the tag carries the exact published build
git add dist -f
git add node/lib -f
git add node/package.json
git commit -m "gitana driver release build $VERSION"
#
# STEP 4: TAG AND PUSH
#
git tag "$VERSION"
git push origin "$BRANCH"
git push origin "$VERSION"
#
# TEARDOWN
#
git checkout master
git branch -D "$BRANCH"
rm -rf dist