forked from jahudka/certbot-dns-active24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·59 lines (43 loc) · 1.21 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
#!/usr/bin/env bash
set -eu
case "${1:-}" in
major) version_idx=0 ;;
minor) version_idx=1 ;;
patch) version_idx=2 ;;
*)
echo "Usage: $0 <major|minor|patch>"
exit 1
;;
esac
if [[ "$( git status -uno --porcelain=v1 )" != "" ]]; then
echo "Working tree is not clean, please commit all changes first"
exit 1
fi
if [[ ! -d '.venv' ]]; then
python3 -m venv .venv
pip3 install -e .
fi
if [[ "$( which python3 )" != "$( pwd )/.venv/bin/python3" ]]; then
source .venv/bin/activate
fi
IFS=$'\n' version=($( python3 <<EOT
from certbot_dns_active24 import __version__
print(__version__)
version = [int(n) for n in __version__.split('.')]
version[${version_idx}] += 1
version[$(( version_idx + 1 )):] = [0]*$(( 2 - version_idx ))
print('.'.join([str(n) for n in version]))
EOT
))
sed -i '' -e "s/${version[0]}/${version[1]}/g" certbot_dns_active24/__init__.py
git add certbot_dns_active24/__init__.py
git commit -m "Release v${version[1]}"
git tag -s "v${version[1]}" -m "Release v${version[1]}"
git push
git push --tags
mkdir -p dist
rm -rf dist/*
python3 setup.py sdist
pip3 install twine
twine upload --repository certbot-dns-active24 dist/*
echo "Published version ${version[1]}."