This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
release.sh
75 lines (57 loc) · 1.36 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
read -p "Insert version number in the form A.B.C: " ver
# Change version in configuration file
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$ver/g" pdfsak_version.py
echo "Echoing pdfsak_version.py"
cat pdfsak_version.py
read -p "Does it look correct (y/n)? " ans
if [ "$ans" = "y" ]; then
echo "Answered yes. Proceeding."
elif [ "$ans" = "n" ]; then
echo "Answered no. Exiting"
exit
else
echo "Unrecognized answer"
exit
fi
# Create commit for version bump
git add -A
git commit -m "Bump version to $ver"
echo "Echoing commit for version bump"
git diff HEAD^
read -p "Does it look correct (y/n)? " ans
if [ "$ans" = "y" ]; then
echo "Answered yes. Proceeding."
elif [ "$ans" = "n" ]; then
echo "Answered no. Exiting"
exit
else
echo "Unrecognized answer"
exit
fi
# Create annotated tag for this version
git tag -a v$ver -m "Version $ver"
echo "Echoing git tags"
git tag --list
read -p "Does it look correct (y/n)? " ans
if [ "$ans" = "y" ]; then
echo "Answered yes. Proceeding."
elif [ "$ans" = "n" ]; then
echo "Answered no. Exiting"
exit
else
echo "Unrecognized answer"
exit
fi
# Push commit
git push
# Push tag
git push origin v$ver
# Build project
rm -rf dist/
rm -rf build/
rm -rf *.egg-info
python3 -m build
# Upload to PyPI
python3 -m twine upload dist/*
echo "Done. Remember to release on GitHub"