Build sdist and wheels #10
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: Build sdist and wheels | |
on: | |
workflow_dispatch: | |
inputs: | |
upload_to_pypi: | |
description: "Upload to PyPI? Y/[N]" | |
default: "N" | |
jobs: | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
# Python 3.8 is the oldest version supported by build | |
python-version: "3.8" | |
- name: Install pip build | |
run: | | |
python -m pip install "build" | |
- name: Build sdist tarball | |
shell: bash | |
run: | | |
python -m build --sdist . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: | | |
dist/*.tar.gz | |
if-no-files-found: error | |
build_generic_wheel: | |
name: Build generic wheel (without speedups) | |
runs-on: ubuntu-20.04 | |
env: | |
# Build a wheel without speedups that can run on pure Python | |
GENSHI_BUILD_SPEEDUP: 0 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
# Python 3.8 is the oldest version supported by build | |
python-version: "3.8" | |
- name: Install pip build | |
run: | | |
python -m pip install "build" | |
- name: Build wheel | |
shell: bash | |
run: | | |
python -m build --wheel . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: | | |
dist/*.whl | |
if-no-files-found: error | |
deploy: | |
name: "Upload to PyPI if selected" | |
if: github.event.inputs.upload_to_pypi == 'Y' | |
needs: [build_sdist, build_generic_wheel] | |
runs-on: ubuntu-latest | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
TWINE_NON_INTERACTIVE: 1 | |
TWINE_REPOSITORY: pypi | |
steps: | |
- name: Download build artifacts to local runner | |
uses: actions/download-artifact@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: "3.10" | |
- name: Install twine | |
run: | | |
python -m pip install "twine" | |
- name: Upload sdist and wheel to PyPI | |
run: | | |
python -m twine upload --verbose wheels/*.whl sdist/*.tar.gz |