-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·37 lines (29 loc) · 984 Bytes
/
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
latest=$(git tag | egrep "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1)
semver_pattern="([0-9]+\.[0-9]+)\.([0-9]+)"
function sed_inplace() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sed -i "$@"
elif [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "$@"
fi
}
if [[ $latest =~ $semver_pattern ]]
then
major_minor="${BASH_REMATCH[1]}"
patch="${BASH_REMATCH[2]}"
# Increment patch version
patch=$(($patch+1))
new_version="${major_minor}.${patch}"
git checkout -b "v$new_version"
sed_inplace "s/version=\"0.0.1\"/version=\"$new_version\"/" setup.py
sed_inplace "s/version: 0.1.0/version: $new_version/" charts/goji/Chart.yaml
sed_inplace "s/appVersion: \"1.0\"/appVersion: \"$new_version\"/" charts/goji/Chart.yaml
git add setup.py charts/goji/Chart.yaml
git commit -m "Bump version to $new_version"
git tag "v$new_version"
git checkout master
git branch -D "v$new_version"
git push origin "v$new_version"
else
echo "No tags found?"
fi