Skip to content

Clean up GitHub Action, add manual trigger for testing (#132) #2

Clean up GitHub Action, add manual trigger for testing (#132)

Clean up GitHub Action, add manual trigger for testing (#132) #2

Workflow file for this run

name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish'
required: true
default: ''
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install pypa/setuptools
run: python -m pip install wheel setuptools
- name: Extract tag name or use manual input
id: get_version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
fi
- name: Update version in setup.py
run: sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.get_version.outputs.VERSION }}/g" setup.py
- name: Build a binary wheel
run: python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}