Publish to PyPI #2
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: Publish to PyPI | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
jobs: | |
release-build: | |
name: Build Python Package | |
runs-on: windows-latest | |
steps: | |
- run: git config --global core.autocrlf input | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Cygwin Action | |
uses: cygwin/cygwin-install-action@v5 | |
with: | |
packages: > | |
mingw64-x86_64-gcc-core | |
mingw64-i686-gcc-core | |
libtool | |
autoconf | |
automake | |
make | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install wheel cibuildwheel | |
- name: Build the package | |
run: ./cygwin_cibuildwheel_build.sh | |
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o igncr -o pipefail {0} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-wheels | |
path: wheelhouse/ | |
pypi-publish: | |
if: github.event_name != 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
needs: | |
- release-build | |
environment: | |
name: pypi | |
permissions: | |
id-token: write | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-wheels | |
path: dist/ | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ |