Update setup.py #4
Workflow file for this run
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 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 | |
permissions: | |
id-token: write # OIDC for PyPi Trusted Publisher feature | |
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] |