Skip to content

add +pyodide to gh release #15

add +pyodide to gh release

add +pyodide to gh release #15

Workflow file for this run

name: Build wheels
on:
workflow_dispatch:
push:
branches: ["master", "emscripten"]
tags: ["v*"]
jobs:
native-wheels:
name: Native wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade pip cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: cp312-*
CIBW_SKIP: pp* *-musllinux_*
CIBW_ARCHS_MACOS: arm64
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=26.0
- name: Upload native wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/*.whl
wasm-wheel:
name: WASM wheel (Pyodide)
runs-on: ubuntu-latest
env:
PYODIDE_EMSCRIPTEN_TAG: any
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade pip build wheel
- name: Build wasm wheel
run: python -m build --wheel
env:
PHREEQPYTHON_TARGET: wasm
PHREEQPYTHON_LOCAL_VERSION: pyodide
- name: Retag wheel for Pyodide
shell: bash
run: |
set -euo pipefail
WHEEL_PATH=$(ls dist/*.whl)
# This wheel bundles a ctypes-loaded side module, not a CPython extension module.
# Use a broad Python/ABI tag and keep the strict emscripten platform tag.
python -m wheel tags \
--python-tag py3 \
--abi-tag none \
--platform-tag "${PYODIDE_EMSCRIPTEN_TAG}" \
"${WHEEL_PATH}"
rm -f "${WHEEL_PATH}"
- name: Upload wasm wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheels-wasm
path: dist/*.whl
sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade pip build
- name: Build sdist
run: python -m build --sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
pypi-publish:
name: Publish to PyPI
needs: [native-wheels, sdist]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
steps:
- name: Download Linux wheel artifacts
uses: actions/download-artifact@v4
with:
name: wheels-ubuntu-latest
path: dist
merge-multiple: true
- name: Download Windows wheel artifacts
uses: actions/download-artifact@v4
with:
name: wheels-windows-latest
path: dist
merge-multiple: true
- name: Download macOS wheel artifacts
uses: actions/download-artifact@v4
with:
name: wheels-macos-14
path: dist
merge-multiple: true
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Show artifacts
shell: bash
run: ls -la dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
github-release-wasm:
name: Attach WASM wheel to GitHub release
needs: [wasm-wheel]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download wasm wheel artifact
uses: actions/download-artifact@v4
with:
name: wheels-wasm
path: dist
- name: Upload wasm wheel as release asset
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
generate_release_notes: true