-
Notifications
You must be signed in to change notification settings - Fork 18
/
bump_version.sh
executable file
·46 lines (42 loc) · 1.29 KB
/
bump_version.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
#!/bin/bash
####################################
# #
# Prints commands necessary to #
# do a version bump. Usage: #
# #
# ./bump_version.sh X.X.X Y.Y.Y #
# #
# where X.X.X is the old version #
# and X.X.X is the new version #
# #
####################################
set -e # fail script on any error, show commands
OLD_VERSION=$1 # e.g., 0.0.0
NEW_VERSION=$2 # e.g., 0.0.1
NEW_VERSION_LENGTH=$(printf "%s" "$NEW_VERSION" | wc -c)
DASHES=$(printf "%${NEW_VERSION_LENGTH}s" | sed 's/ /-/g')
echo "git checkout master"
echo "git pull"
echo "git checkout -b release/v${NEW_VERSION}"
echo ""
echo "sed -i -e 's/${OLD_VERSION}/${NEW_VERSION}/g' eeweather/__version__.py"
echo "sed -i -e '/Development/,/-----------/ c\\
Development\\
-----------\\
\\
* Placeholder\\
\\
${NEW_VERSION}\\
${DASHES}\\
' CHANGELOG.md"
echo "rm -f eeweather/__version__.py-e"
echo "rm -f CHANGELOG.md-e"
echo ""
echo "git commit -am \"Bump version\""
echo "git tag v${NEW_VERSION}"
echo "git push -u origin release/v${NEW_VERSION} --tags"
echo "docker-compose run --rm python setup.py upload"
echo "git checkout master"
echo "git pull"
echo "git merge release/v${NEW_VERSION}"
echo "git push"