Python Package Publication #51
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: Python Package Publication | |
on: | |
workflow_dispatch: | |
inputs: | |
release-version: | |
required: true | |
dry-run: | |
required: true | |
default: true | |
type: boolean | |
linux: | |
type: boolean | |
required: true | |
default: true | |
other-os: | |
type: boolean | |
required: true | |
default: true | |
jobs: | |
linux-build: | |
if: ${{ inputs.linux }} | |
runs-on: ubuntu-latest | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Python wheels manylinux stable build | |
uses: RalfG/[email protected] | |
with: | |
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311' | |
- name: upload wheel | |
if: ${{ !inputs.dry-run }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel setuptools twine | |
twine upload dist/*-manylinux*.whl | |
continue-on-error: false | |
other-os-build: | |
if: ${{ inputs.other-os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: build wheel | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel setuptools twine | |
python setup.py bdist_wheel | |
- name: upload wheel | |
if: ${{ !inputs.dry-run }} | |
run: | | |
twine upload dist/* | |
continue-on-error: false | |
release-build: | |
if: ${{ !inputs.dry-run }} | |
needs: [ linux-build, other-os-build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.event.inputs.release-version }} | |
run: | | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ | |
--generate-notes |