[pre-commit.ci] pre-commit autoupdate #949
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to PyPI | |
on: push | |
jobs: | |
build-n-publish: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.pull_request.labels.*.name, 'auto-pr')" | |
steps: | |
- uses: actions/checkout@master | |
# https://github.com/ansible/pylibssh/blob/1e7b17f/.github/workflows/build-test-n-publish.yml#L146-L151 | |
- name: Get history and tags for SCM versioning to work | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
git describe --tags | |
git describe --tags $(git rev-list --tags --max-count=1) | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.10" | |
- name: Install build | |
run: | | |
python -m pip install build | |
python -m pip install setuptools_scm | |
python setup.py --version | |
- name: Create setuptools_scm env variable | |
if: startsWith(github.ref, 'refs/tags/') != true | |
shell: bash | |
run: | | |
wget https://gist.github.com/plaplant/0902f09e59166bac742bbd554f3cd2f9/raw/make_dev_version.sh -O ../make_dev_version.sh | |
version=$(bash ../make_dev_version.sh) | |
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV | |
- name: Build a source tarball | |
run: python -m build --sdist . | |
# deploy to Test PyPI on any push except when merging to production, since that will | |
# already exist, and thus fail. | |
- name: Publish distribution 📦 to Test PyPI | |
if: ${{ !contains(github.ref, 'production') }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
# deploy to actual PyPI only when a tag is pushed (which should happen only | |
# automatically on production) | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_password }} |