File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # bump_version.sh (show|major|minor|patch|prerelease|build)
4
+
5
+ set -o nounset
6
+ set -o errexit
7
+ set -o pipefail
8
+
9
+ VERSION_FILE=src/example/_version.py
10
+
11
+ HELP_INFORMATION=" bump_version.sh (show|major|minor|patch|prerelease|build|finalize)"
12
+
13
+ old_version=$( sed -n " s/^__version__ = \" \(.*\)\" $/\1/p" $VERSION_FILE )
14
+
15
+ if [ $# -ne 1 ]
16
+ then
17
+ echo " $HELP_INFORMATION "
18
+ else
19
+ case $1 in
20
+ major|minor|patch|prerelease|build)
21
+ new_version=$( python -c " import semver; print(semver.bump_$1 ('$old_version '))" )
22
+ echo Changing version from " $old_version " to " $new_version "
23
+ # A temp file is used to provide compatability with macOS development
24
+ # as a result of macOS using the BSD version of sed
25
+ tmp_file=/tmp/version.$$
26
+ sed " s/$old_version /$new_version /" $VERSION_FILE > $tmp_file
27
+ mv $tmp_file $VERSION_FILE
28
+ git add $VERSION_FILE
29
+ git commit -m" Bump version from $old_version to $new_version "
30
+ git push
31
+ ;;
32
+ finalize)
33
+ new_version=$( python -c " import semver; print(semver.finalize_version('$old_version '))" )
34
+ echo Changing version from " $old_version " to " $new_version "
35
+ # A temp file is used to provide compatability with macOS development
36
+ # as a result of macOS using the BSD version of sed
37
+ tmp_file=/tmp/version.$$
38
+ sed " s/$old_version /$new_version /" $VERSION_FILE > $tmp_file
39
+ mv $tmp_file $VERSION_FILE
40
+ git add $VERSION_FILE
41
+ git commit -m" Bump version from $old_version to $new_version "
42
+ git push
43
+ ;;
44
+ show)
45
+ echo " $old_version "
46
+ ;;
47
+ * )
48
+ echo " $HELP_INFORMATION "
49
+ ;;
50
+ esac
51
+ fi
Original file line number Diff line number Diff line change 1
1
-r requirements-test.txt
2
2
ipython
3
+ semver
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -o nounset
4
+ set -o errexit
5
+ set -o pipefail
6
+
7
+ version=$( ./bump_version.sh show)
8
+
9
+ git tag " v$version " && git push --tags
You can’t perform that action at this time.
0 commit comments