nomyo/.forgejo/workflows/publish.yml

46 lines
1.2 KiB
YAML

name: Publish to PyPI
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
build-and-publish:
name: Build & Publish (${{ matrix.runner }}, py${{ matrix.python }})
runs-on: ${{ matrix.runner }}
container:
image: python:${{ matrix.python }}-bookworm
strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
runner: [docker-amd64, docker-arm64]
steps:
- name: Checkout repository
run: |
git clone --depth=1 --branch "${{ github.ref_name }}" \
"https://oauth2:${{ github.token }}@bitfreedom.net/code/${{ github.repository }}.git" \
.
- name: Install build tools
run: |
apt-get update -qq && apt-get install -y patchelf
pip install build Cython twine auditwheel
- name: Build wheel
run: python -m build --wheel
- name: Repair wheel to manylinux
run: auditwheel repair dist/*.whl --wheel-dir wheelhouse/
- name: Check wheel metadata
run: twine check wheelhouse/*.whl
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --verbose wheelhouse/*.whl