Skip to content

Use a reproducible configuration to build docs. #900

Use a reproducible configuration to build docs.

Use a reproducible configuration to build docs. #900

Workflow file for this run

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 }}-${{ matrix.os_version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- os_version: 'latest'
- os: 'macos'
os_version: '14'
steps:
- uses: actions/checkout@v4.1.2
- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.python_version }}.*"
- uses: actions/upload-artifact@v4.3.1
with:
name: dist-python-${{ matrix.python_version }}-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.2
- uses: actions/setup-python@v5.1.0
name: Install Python
with:
python-version: '3.11'
- uses: actions/cache@v4.0.2
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@v4.3.1
with:
name: dist-sdist
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@v4.1.4
with:
merge-multiple: 'true'
pattern: 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.14
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.14
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true