Skip to content
Myr

Publish workflow (#913)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Publish workflow * Set PYTHONPATH to allow auto docs to import package * Seperate install, build, publish steps

authored by Tom Christie · committed by GitHub · parent 97cf9da · Browse files · 4 files+54 added−31 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+54 added−31 removed

  • other:+54 added−31 removed

4 files+54 added−31 removed

added:.github/workflows/publish.yml+27 added
modified:.github/workflows/test-suite.yml-2 removed
added:scripts/build+13 added
1#!/bin/sh -e23if [ -d 'venv' ] ; then4 PREFIX="venv/bin/"5else6 PREFIX=""7fi89set -x1011${PREFIX}python setup.py sdist bdist_wheel12${PREFIX}twine check dist/*13${PREFIX}mkdocs build
modified:scripts/publish+14 added-29 removed
1#!/bin/sh -e23export PACKAGE="httpx"4export VERSION=`cat ${PACKAGE}/__version__.py | grep __version__ | sed "s/__version__ = //" | sed "s/'//g"`5export PREFIX=""3VERSION_FILE="httpx/__init__.py"45if [ -d 'venv' ] ; then7 export PREFIX="venv/bin/"6 PREFIX="venv/bin/"7else8 PREFIX=""9fi1010scripts/clean11if [ ! -z "$GITHUB_ACTIONS" ]; then12 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"13 git config --local user.name "GitHub Action"1412if ! command -v "${PREFIX}twine" &>/dev/null ; then13 echo "Unable to find the 'twine' command."14 echo "Install from PyPI, using '${PREFIX}pip install twine'."15 exit 116fi15 VERSION=`grep __version__ ${VERSION_FILE} | grep -o '[0-9][^"]*'`1618if ! ${PREFIX}pip show wheel &>/dev/null ; then19 echo "Unable to find the 'wheel' command."20 echo "Install from PyPI, using '${PREFIX}pip install wheel'."17 if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then18 echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'"19 exit 120 fi21fi2224if ! command -v "${PREFIX}mkdocs" &>/dev/null ; then25 echo "Unable to find the 'mkdocs' command."26 echo "Install from PyPI, using '${PREFIX}pip install mkdocs'."27 exit 128fi23set -x2430find ${PACKAGE} -type f -name "*.py[co]" -delete31find ${PACKAGE} -type d -name __pycache__ -delete3233${PREFIX}python setup.py sdist bdist_wheel25${PREFIX}twine upload dist/*35${PREFIX}mkdocs gh-deploy3637echo "You probably want to also tag the version now:"38echo "git tag -a ${VERSION} -m 'version ${VERSION}'"39echo "git push --tags"4041scripts/clean26${PREFIX}mkdocs gh-deploy --force