-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·61 lines (48 loc) · 1.19 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
#!/bin/bash
G_SYNOPSIS="
NAME
release.sh
SYNOPSIS
release.sh <ver> [--pypi]
ARGS
<ver>
A version string. For best practices make this version the same as
the VERSION class variable defined in your ChrisApp-derived Python class.
--pypi
Optional flag to also upload the new version to PyPI.
DESCRIPTION
release.sh is a simple helper script to tag and upload a new version of the plugin
app to Github. If --pypi is passed then the new version is also uploaded to PyPI
(Python Package Index).
"
if [[ "$#" -eq 0 ]] || [[ "$#" -gt 2 ]]; then
echo "$G_SYNOPSIS"
exit 1
fi
VER=$1
if [[ "$#" -eq 2 ]]; then
if [[ "$1" != '--pypi' ]] && [[ "$2" != '--pypi' ]]; then
echo "$G_SYNOPSIS"
exit 1
fi
if [[ "$1" == '--pypi' ]]; then
VER=$2
fi
fi
if [[ $VER =~ ^[0-9.]+$ ]]; then
echo Pushing $VER to Github ...
git add -A
git commit -m "v${VER}"
git push origin master
git tag $VER
git push origin --tags
else
echo "Invalid version number format $VER."
exit 1
fi
if [[ "$#" -eq 2 ]]; then
echo Pushing $VER to PyPI ...
rstcheck README.rst
python3 setup.py sdist
twine upload dist/z2labelmap-${VER}.tar.gz
fi