Skip to content

Fix: build workflow #55

Fix: build workflow

Fix: build workflow #55

name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- "v*.*.*"
branches: [build]
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8.0', '3.9.0', '3.10.0', '3.11.0', '3.12.0']
architecture: ['x86', 'x64']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Install pypa/build
run: python -m pip install setuptools wheel
- name: Build a source tarball
if: ${{ matrix.python-version == '3.10.0' && matrix.architecture == 'x86' }}
run: |
python --version
python setup.py sdist
- name: Build a binary wheel
run: |
python --version
python setup.py bdist_wheel
- name: Install twine
run: python -m pip install twine
- name: Publish distribution to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/* --skip-existing
- name: Get the filenames
id: get_filenames
run: |
$wheel = Get-ChildItem -Path dist -Filter *.whl | Select-Object -First 1 -ExpandProperty FullName
echo "::set-output name=WHEEL_FILE::$wheel"
$sdist = Get-ChildItem -Path dist -Filter *.tar.gz | Select-Object -First 1 -ExpandProperty FullName
echo "::set-output name=SDIST_FILE::$sdist"
- name: Upload Wheel to Release
uses: softprops/action-gh-release@v2
with:
tag_name: v0.2.4
files: |
${{ steps.get_filenames.outputs.WHEEL_FILE }}
- name: Upload Source Distribution to Release
uses: softprops/action-gh-release@v2
if: ${{ matrix.python-version == '3.10.0' && matrix.architecture == 'x86' }}
with:
tag_name: v0.2.4
files: |
${{ steps.get_filenames.outputs.SDIST_FILE }}