-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathupload.sh
More file actions
executable file
·46 lines (44 loc) · 1.13 KB
/
upload.sh
File metadata and controls
executable file
·46 lines (44 loc) · 1.13 KB
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
#!/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
pip install build
OLDVERSION=$(grep '^version' pyproject.toml | sed -e 's/.*= "//' -e 's/"//')
vi pyproject.toml
VERSION=$(grep '^version' pyproject.toml | 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
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=log.showsignature GIT_CONFIG_VALUE_0=false gitchangelog
vi CHANGELOG.rst
echo "Ready to push $VERSION (cntrl-c to quit)?"
read ANS
git commit -m "Version $VERSION" CHANGELOG.rst pyproject.toml
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
python3.9 -m build
twine upload dist/*