|
1 | 1 | #!/bin/sh -e |
2 | 2 |
|
3 | | -export VERSION=`cat httpcore/__init__.py | grep __version__ | sed "s/__version__ = //" | sed "s/'//g"` |
4 | | -export PREFIX="" |
| 3 | +VERSION_FILE="httpcore/__init__.py" |
| 4 | +PYTHONPATH=. |
| 5 | + |
5 | 6 | if [ -d 'venv' ] ; then |
6 | | - export PREFIX="venv/bin/" |
| 7 | + PREFIX="venv/bin/" |
| 8 | +else |
| 9 | + PREFIX="" |
7 | 10 | fi |
8 | 11 |
|
9 | | -scripts/clean |
| 12 | +if [ ! -z "$GITHUB_ACTIONS" ]; then |
| 13 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 14 | + git config --local user.name "GitHub Action" |
10 | 15 |
|
11 | | -if ! command -v "${PREFIX}twine" &>/dev/null ; then |
12 | | - echo "Unable to find the 'twine' command." |
13 | | - echo "Install from PyPI, using '${PREFIX}pip install twine'." |
14 | | - exit 1 |
15 | | -fi |
| 16 | + VERSION=`grep __version__ ${VERSION_FILE} | grep -o '[0-9][^"]*'` |
16 | 17 |
|
17 | | -if ! command -v "${PREFIX}wheel" &>/dev/null ; then |
18 | | - echo "Unable to find the 'wheel' command." |
19 | | - echo "Install from PyPI, using '${PREFIX}pip install wheel'." |
| 18 | + if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then |
| 19 | + echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'" |
20 | 20 | exit 1 |
| 21 | + fi |
21 | 22 | fi |
22 | 23 |
|
23 | | -find httpcore -type f -name "*.py[co]" -delete |
24 | | -find httpcore -type d -name __pycache__ -delete |
| 24 | +set -x |
25 | 25 |
|
| 26 | +${PREFIX}pip install twine wheel mkdocs mkdocs-material mkautodoc |
26 | 27 | ${PREFIX}python setup.py sdist bdist_wheel |
27 | 28 | ${PREFIX}twine upload dist/* |
28 | | -${PREFIX}mkdocs gh-deploy |
29 | | - |
30 | | -echo "You probably want to also tag the version now:" |
31 | | -echo "git tag -a ${VERSION} -m 'version ${VERSION}'" |
32 | | -echo "git push --tags" |
33 | | - |
34 | | -scripts/clean |
| 29 | +${PREFIX}mkdocs gh-deploy --force |
0 commit comments