Skip to content

Build + Release Wheels Linux #25

Build + Release Wheels Linux

Build + Release Wheels Linux #25

name: Build + Release Wheels Linux
on:
workflow_dispatch:
inputs:
deploy_to_testpypi:
description: "Whether the build should be deployed to test.pypi.org instead of regular PyPI"
required: true
default: 'false'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine auditwheel
- name: Build in manylinux container
run: |
docker pull quay.io/pypa/manylinux1_x86_64
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/ci/build_manylinux.sh build
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)
- uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Determine PyPI target
id: pypi_target
run: |
if [ "${{ github.event.inputs.deploy_to_testpypi }}" == "true" ]; then
echo "::set-output name=repository_url::https://test.pypi.org/legacy/"
echo "::set-output name=api_token::${{ secrets.TEST_PYPI_API_TOKEN }}"
else
echo "::set-output name=repository_url::https://upload.pypi.org/legacy/"
echo "::set-output name=api_token::${{ secrets.PYPI_API_TOKEN }}"
fi
- name: Upload to PyPI repositories
run: twine upload dist/* --verbose --skip-existing -u __token__ -p ${{ steps.pypi_target.outputs.api_token }}
env:
TWINE_REPOSITORY_URL: ${{ steps.pypi_target.outputs.repository_url }}