Merge pull request #21 from quanted/dev #14
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: Build and Publish Python Packages | |
on: | |
# release: | |
# types: [published] | |
push: # Only for testing while publish-to-pypi is commented out | |
branches: | |
- main | |
env: | |
MACOSX_DEPLOYMENT_TARGET: "10.12" | |
CIBW_BUILD: "cp310-* cp311-* cp312-*" | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.22.0 | |
- name: Install setuptools | |
run: | | |
python -m pip install --upgrade pip | |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable | |
echo "PATH=${PATH}:${HOME}/.cargo/bin" >> "$GITHUB_ENV" | |
rustc --version | |
python -m pip install build setuptools setuptools-rust | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir py_dist | |
- name: Store the compiled packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: esat-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: py_dist/ | |
publish-to-testpypi: | |
name: Publish Python 🐍 distribution 📦 to TestPyPI | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/esat | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: esat-wheels-* | |
merge-multiple: true | |
path: py_dist/ | |
- name: Publish distribution 📦 to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: py_dist/ | |
skip-existing: true | |
repository-url: https://test.pypi.org/legacy/ | |
publish-to-pypi: | |
name: >- | |
Publish Python 🐍 distribution 📦 to PyPI | |
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/esat | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: esat-wheels-* | |
merge-multiple: true | |
path: py_dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: py_dist/ | |
# Currently not intending on using automated github-release as the primary trigger for pypi publishing is by creating | |
# a new github version release. This is done manually by the developer. | |
# github-release: | |
# name: >- | |
# Sign the Python 🐍 distribution 📦 with Sigstore | |
# and upload them to GitHub Release | |
# needs: | |
# - publish-to-pypi | |
# runs-on: ubuntu-latest | |
# | |
# permissions: | |
# contents: write # IMPORTANT: mandatory for making GitHub Releases | |
# id-token: write # IMPORTANT: mandatory for sigstore | |
# | |
# steps: | |
# - name: Download all the dists | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: python-package-distributions | |
# path: py_dist/ | |
# - name: Sign the dists with Sigstore | |
# uses: sigstore/gh-action-sigstore-python@v3.0.0 | |
# with: | |
# inputs: >- | |
# ./py_dist/*.tar.gz | |
# ./py_dist/*.whl | |
# - name: Create GitHub Release | |
# env: | |
# GITHUB_TOKEN: ${{ github.token }} | |
# run: >- | |
# gh release create | |
# '${{ github.ref_name }}' | |
# --repo '${{ github.repository }}' | |
# --notes "" | |
# - name: Upload artifact signatures to GitHub Release | |
# env: | |
# GITHUB_TOKEN: ${{ github.token }} | |
# # Upload to GitHub Release using the `gh` CLI. | |
# # `dist/` contains the built packages, and the | |
# # sigstore-produced signatures and certificates. | |
# run: >- | |
# gh release upload | |
# '${{ github.ref_name }}' py_dist/** | |
# --repo '${{ github.repository }}' |