Prevent deprecation warning #658
Workflow file for this run
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: PyPI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
# Trigger on pull requests. | |
pull_request: | |
# Trigger on pushes to the mainline branches and version tags. This prevents building commits | |
# twice when the pull request source branch is in the same repository. | |
push: | |
branches: | |
- "trunk-patch" | |
- "trunk-minor" | |
- "trunk-major" | |
tags: | |
- "v*" | |
# Trigger on request. | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Build wheels [py${{ matrix.python_version }}, ${{ matrix.os }}] | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, windows, macos] | |
python_version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3.5.3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.13.1 | |
env: | |
CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.python_version }}.*" | |
- uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: dist | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.5.3 | |
- uses: actions/setup-python@v4.6.1 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- uses: actions/cache@v3.3.1 | |
with: | |
path: ~/.cache/pip | |
key: gsd-build-wheels-pip-${{ hashFiles('.github/requirements-build-sdist.txt') }} | |
restore-keys: | | |
gsd-build-wheels-pip- | |
- name: Install build | |
run: python3 -m pip --disable-pip-version-check install -r .github/requirements-build-sdist.txt --progress-bar=off | |
- name: Build sdist | |
run: python -m build --sdist --outdir dist/ . | |
- uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
upload_pypi: | |
name: Publish [PyPI] | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: dist | |
path: dist | |
- name: Check files | |
run: ls -lR dist | |
- name: Upload to PyPI | |
# upload to PyPI on every tag starting with 'v' | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/gh-action-pypi-publish@v1.8.7 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Upload to TestPyPI | |
# otherwise, upload to TestPyPi | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) }} | |
uses: pypa/gh-action-pypi-publish@v1.8.7 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true |