Skip to content

Build sdist and wheels #8

Build sdist and wheels

Build sdist and wheels #8

Workflow file for this run

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@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.6"
- 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@v2
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@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.6"
- name: Install pip build
run: |
python -m pip install "build"
- name: Build wheel
shell: bash
run: |
python -m build --wheel .
- uses: actions/upload-artifact@v2
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@v2
- uses: actions/setup-python@v2
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