-
Notifications
You must be signed in to change notification settings - Fork 157
/
upload.sh
executable file
·45 lines (43 loc) · 1.03 KB
/
upload.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
#!/usr/bin/env bash
#
# Make sure you have a ~/.pypirc file first
#
CHANGES=$(git diff-index --name-only HEAD --)
if [ -n "${CHANGES}" ]
then
echo "Changes have not been committed"
exit 1
fi
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "${BRANCH}" != "main" ]
then
echo "You must be on main"
exit 1
fi
git pull
pip install gitchangelog
pip install twine
OLDVERSION=$(grep version setup.py | sed -e "s/.*='//" -e "s/',//")
vi setup.py
VERSION=$(grep version setup.py | sed -e "s/.*='//" -e "s/',//")
if [ "$OLDVERSION" == "$VERSION" ]
then
echo "Old version $OLDVERSION same as $VERSION"
read ANS
fi
git tag -a $VERSION -m v$VERSION
gitchangelog
vi CHANGELOG.rst
echo "Ready to push $VERSION (cntrl-c to quit)?"
read ANS
git commit -m "Version $VERSION" CHANGELOG.rst setup.py
git push origin main
git tag --force -a $VERSION -m v$VERSION
git push origin --tags
#python setup.py register -r pypi
# old school
# python setup.py sdist upload -r pypi
# twine
rm -rf dist
python setup.py sdist # bdist_wheel
twine upload dist/*