Build + Release Wheels Linux #25
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 + 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 }} |