-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease.sh
executable file
·55 lines (37 loc) · 1.05 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
PACKAGE="milad"
REMOTE="muhrin"
VERSION_FILE=${PACKAGE}/version.py
version=$1
while true; do
read -p "Release version ${version}? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
set -x
ver_info=`python -c "print(tuple(int(entry) for entry in '$version'.split('.')))"`
sed -i "/^version_info/c version_info = ${ver_info}" $VERSION_FILE
current_branch=`git rev-parse --abbrev-ref HEAD`
tag="v${version}"
relbranch="release-${version}"
echo Releasing version $version
git checkout -b $relbranch
git add ${VERSION_FILE}
git commit --no-verify -m "Release ${version}"
git tag -a $tag -m "Version $version"
# Merge into main
git checkout main
git merge $relbranch
# And back into the working branch (usually develop)
git checkout $current_branch
git merge $relbranch
git branch -d $relbranch
# Push everything
git push --tags $REMOTE main $current_branch
# Release on pypi
rm -r dist build *.egg-info
python setup.py sdist
python setup.py bdist_wheel --universal
twine upload dist/*