-
Notifications
You must be signed in to change notification settings - Fork 16
/
release.sh
executable file
·43 lines (32 loc) · 1.18 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
#!/bin/bash
# This script is used to generate releases of the python taskcluster client in
# a uniform way and upload it to pypi. It should be the only way that releases
# are created.
# Note that the VERSION in setup.py should be updated before release!
if [ -n "$VIRTUAL_ENV" ]; then
echo "Deactivate your virtualenv first"
exit 1
fi
REPOSITORY_URL=https://test.pypi.org/legacy/
if [ "$1" = "--real" ]; then
REPOSITORY_URL=https://upload.pypi.org/legacy/
fi
# step into directory containing this script
cd "$(dirname "${0}")"
# exit in case of bad exit code
set -e
# begin making the distribution
rm -f dist/*
rm -rf .release
mkdir -p .release
python3 -mvenv .release/py3
.release/py3/bin/pip install -U pip
.release/py3/bin/pip install -U setuptools twine wheel
.release/py3/bin/python setup.py sdist
.release/py3/bin/python setup.py bdist_wheel
# Work around https://bitbucket.org/pypa/wheel/issues/147/bdist_wheel-should-start-by-cleaning-up
rm -rf build/
ls -al dist
# Publish to PyPI using Twine, as recommended by:
# https://packaging.python.org/tutorials/distributing-packages/#uploading-your-project-to-pypi
.release/py3/bin/twine upload --repository-url $REPOSITORY_URL dist/*