-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.sh
executable file
·46 lines (36 loc) · 1.22 KB
/
build.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
#!/usr/bin/env bash
# IMPORTANT: you must be on the master branch before running this script!
# 1. Sets package version
# 2. Commits to master
# 3. Creates new tag and pushes tag
# 4. Publishes to npm
# 5. Builds and pushes docker images
# Change to script directory
cd `dirname $0`
sd=`pwd`
projRoot=$sd
version=$1
if [ "${version}" == "" ]; then
echo "Usage: build.sh version"
exit
fi
# Set package version. Note: -e option required for OSX
# (https://stackoverflow.com/a/19457213/2831606)
sed -i '' -e "s/\"version\": \"[^\"]*\"/\"version\": \"${version}\"/g" $projRoot/package.json
# Commit to master
git add -A
git commit -m "chore(version): ${version}"
git push origin master
# Create new tag and push
git tag -a v${version} -m "${version}"
git push origin --tags
# Publish to npm
cd $projRoot
npm publish
# Build and push new docker images. We use the no-cache option as we want the latest package on npm
# to be used
cd $projRoot/docker
docker build --no-cache -t redgeoff/replicate-couchdb-cluster:${version} .
docker tag redgeoff/replicate-couchdb-cluster:${version} redgeoff/replicate-couchdb-cluster:latest
docker push redgeoff/replicate-couchdb-cluster:${version}
docker push redgeoff/replicate-couchdb-cluster:latest