-
Notifications
You must be signed in to change notification settings - Fork 68
/
bump_version.sh
executable file
·38 lines (35 loc) · 1.03 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
#!/bin/bash
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' eemeter/__version__.py"
echo "sed -i -e '/Development/,/-----------/ c\\
Development\\
-----------\\
\\
* Placeholder\\
\\
${NEW_VERSION}\\
${DASHES}\\
' CHANGELOG.md"
echo "rm -f eemeter/__version__.py-e"
echo "rm -f CHANGELOG.md-e"
echo ""
echo "git commit -am \"Bump version\" -s"
echo "git tag v${NEW_VERSION}"
echo "git push -u origin release/v${NEW_VERSION} --tags"
echo "git checkout master"
echo "git pull"
echo "git merge release/v${NEW_VERSION}"
echo "git push"
echo ""
echo "rm -r dist build eemeter.egg-info" # reset build dirs
echo "git checkout v${NEW_VERSION}"
echo "python setup.py upload" # requires PyPI credentials
echo "git checkout master"