Publish Python Package #33
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: Publish Python Package | |
on: | |
release: | |
types: [published] | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Create source distribution | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pyitt-cibw-sdist | |
path: dist/*.tar.gz | |
retention-days: 1 | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "*-win32 *-win_amd64 *-manylinux_i686 *-manylinux_x86_64 *-musllinux_i686 *-musllinux_x86_64" | |
CIBW_SKIP: cp36-* cp37-* pp37-* pp38-* | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_I686_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_PYPY_I686_IMAGE: manylinux2014 | |
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2 | |
CIBW_MUSLLINUX_I686_IMAGE: musllinux_1_2 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pyitt-cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
retention-days: 1 | |
upload_pypi: | |
name: Publish to PyPI | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pyitt | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: pyitt-cibw-* | |
path: ./dist | |
merge-multiple: true | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@v1 | |
upload_release_artifacts: | |
name: Upload artifacts to GitHub Release | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download all the dists | |
id: download-artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: pyitt-cibw-* | |
path: dist | |
merge-multiple: true | |
- name: Upload artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
for filename in "${{steps.download-artifact.outputs.download-path}}"/*; do | |
gh release upload "${{ github.ref_name }}" "$filename" | |
done |