Skip to content

Commit 410f797

Browse files
committed
feat(build)
1 parent 2da0de9 commit 410f797

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

build.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
# IMPORTANT: you must be on the master branch before running this script!
4+
5+
# 1. Sets package version
6+
# 2. Commits to master
7+
# 3. Creates new tag and pushes tag
8+
# 4. Publishes to npm
9+
# 5. Builds and pushes docker images
10+
11+
# Change to script directory
12+
cd `dirname $0`
13+
sd=`pwd`
14+
15+
version=$1
16+
17+
if [ "${version}" == "" ]; then
18+
echo "Usage: build.sh version"
19+
exit
20+
fi
21+
22+
# Set package version. Note: -e option required for OSX
23+
# (https://stackoverflow.com/a/19457213/2831606)
24+
sed -i '' -e "s/\"version\": \"[^\"]*\"/\"version\": \"${version}\"/g" $sd/../package.json
25+
26+
# Commit to master
27+
git add -A
28+
git commit -m "chore(version): ${version}"
29+
git push origin master
30+
31+
# Create new tag and push
32+
git tag -a v${version} -m "${version}"
33+
git push origin --tags
34+
35+
# Publish to npm
36+
cd $sd/..
37+
npm publish
38+
39+
# Build and push new docker images. We use the no-cache option as we want the latest package on npm
40+
# to be used
41+
cd $sd/../docker
42+
docker build --no-cache -t redgeoff/replicate-couchdb-cluster:${version} .
43+
docker tag redgeoff/replicate-couchdb-cluster:${version} redgeoff/replicate-couchdb-cluster:latest
44+
docker push redgeoff/replicate-couchdb-cluster:${version}
45+
docker push redgeoff/replicate-couchdb-cluster:latest

0 commit comments

Comments
 (0)