Skip to content

Workflow file for this run

name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- "v*.*.*"
# push:
# branches: [build]
# release:
# types: [published]
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: windows-latest
strategy:
matrix:
python-version: ['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 build
- name: Build a source tarball
if: ${{ matrix.python-version == '3.10.0' && matrix.architecture == 'x86' }}
run: python -m build --sdist . --outdir dist/
- name: Build a binary wheel
run: python -m build --wheel . --outdir dist/
- 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.2-alpha
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.2-alpha
files: |
${{ steps.get_filenames.outputs.SDIST_FILE }}