-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·48 lines (37 loc) · 1.07 KB
/
publish.sh
File metadata and controls
executable file
·48 lines (37 loc) · 1.07 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
47
48
#!/bin/sh
# Ensure you first make .pypirc with appropriate tokens
#[pypi]
# username = __token__
# password =
#
#[testpypi]
# username = __token__
# password =
# Exit immediately if a command exits with a non-zero status.
set -e
echo "Formatting code..."
./format-code.sh
echo "Running tests..."
./smoketest.sh
if [ $? -ne 0 ]; then
echo "Tests failed. Aborting publish."
exit 1
fi
echo "Making release commit..."
RELEASE_VERSION=$(grep 'version=' setup.py | cut -d '"' -f 2)
git add .
git commit -m "Release ${RELEASE_VERSION}"
git tag "${RELEASE_VERSION}"
git push origin main
git push origin "${RELEASE_VERSION}"
echo "Cleaning up old distribution files..."
rm -rf dist
echo "Installing/upgrading build tools (build, twine, setuptools, wheel, pytest)..."
pip install --upgrade build twine setuptools wheel pytest
echo "Building the distribution..."
python -m build
echo "Verifying the distribution with twine check..."
python -m twine check dist/*
echo "Uploading the distribution to PyPI..."
python -m twine upload dist/*
echo "Publish script finished successfully."