Bump docker/login-action from 2 to 3 #198
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: Python package build and publish | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: {} | |
repository_dispatch: {} | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04 ] # macOS-11 | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name != 'repository_dispatch' }} | |
with: | |
fetch-depth: 0 # slow, but gets all the tags | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'repository_dispatch' }} | |
with: | |
fetch-depth: 0 # slow, but gets all the tags | |
ref: ${{ github.event.client_payload.ref }} | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v4 | |
# - name: Set up QEMU | |
# if: runner.os == 'Linux' | |
# uses: docker/setup-qemu-action@v2 | |
# with: | |
# platforms: all | |
- name: Install cibuildwheel | |
run: python -m pip install -rcibw-requirements.txt | |
- name: set version | |
run: pip install setuptools_scm[toml] && python -m setuptools_scm | |
- name: Build wheels | |
run: | | |
source .github/workflows/wheel-prep.sh | |
export CIBW_ENVIRONMENT="SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH=/project/mypy-stubs SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION}" | |
python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
# configure cibuildwheel to build native 64-bit archs ('auto64'), and some | |
# emulated ones | |
# Linux arm64 wheels are built on circleci | |
CIBW_ARCHS_LINUX: auto64 # ppc64le s390x | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name != 'repository_dispatch' }} | |
with: | |
fetch-depth: 0 # slow, but gets all the tags | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'repository_dispatch' }} | |
with: | |
fetch-depth: 0 # slow, but gets all the tags | |
ref: ${{ github.event.client_payload.ref }} | |
- name: set version | |
run: pip install setuptools_scm[toml] && python -m setuptools_scm | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
# To test: repository-url: https://test.pypi.org/legacy/ | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true |