-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.sh
executable file
·83 lines (70 loc) · 2.1 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env bash
set -e
function check_command() {
if ! command -v $1 >/dev/null; then
echo -e "Install \033[1m$1\033[0m"
exit 1
fi
}
check_command mvn
check_command jq
check_command yq
check_command npm
check_command docker
if [[ "$#" != "1" ]] || [[ ! "$1" =~ ^(patch|minor|major)$ ]]; then
echo "Usage: $0 patch|minor|major"
exit 1
fi
if [[ $(git status --porcelain) ]]; then
echo -e "The repository has changes. Commit first...\033[0;31mAborting!\033[0m"
exit 1
fi
git pull --rebase
cd paperboy-core
npm i
npm run build
npm version $1
version=$(cat package.json | jq -r .version)
npm publish
cd ../paperboy-cli
cat package.json | jq ".version = \"$version\" | .dependencies.\"@neoskop/paperboy\" = \"$version\"" >package.json.new
mv package.json.new package.json
npm i
sed -i.bak "s/version([\"'][[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+[\"'])/version(\"$version\")/g" paperboy-cli.js
rm -rf paperboy-cli.js.bak
npm publish
cd ../paperboy-push-service
cat package.json | jq ".version = \"$version\"" >package.json.new
mv package.json.new package.json
npm i
npm run build
npm publish
docker build -t neoskop/paperboy-push-service:$version .
docker build -t neoskop/paperboy-push-service:latest .
docker push neoskop/paperboy-push-service:$version
docker push neoskop/paperboy-push-service:latest
cd ../paperboy-helm
yq eval -i ".version=\"$version\"" ./Chart.yaml
yq eval -i ".appVersion=\"$version\"" ./Chart.yaml
yq eval -i ".image.tag=\"$version\"" ./values.yaml
cd ../
git add .
git commit -m "chore: Bump version to ${version}."
git tag ${version}
git push origin $version
git pull --rebase
git push
helm package paperboy-helm --destination .deploy
cr upload -o neoskop -r paperboy -p .deploy
git checkout gh-pages
cr index -i ./index.yaml -p .deploy -o neoskop -r paperboy -c https://neoskop.github.io/paperboy/
git add index.yaml
git commit -m "chore: Bump version to ${version}."
git push
git checkout master
rm -rf .deploy/
HELM_CHARTS_DIR=../helm-charts
[ -d $HELM_CHARTS_DIR ] || git clone git@github.com:neoskop/helm-charts.git $HELM_CHARTS_DIR
cd $HELM_CHARTS_DIR
./update-index.sh
cd - &>/dev/null