Skip to content

Commit

Permalink
Clean up GitHub Action, add manual trigger for testing (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigc committed Aug 12, 2024
1 parent 80f809c commit 19cc928
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,38 @@ 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@master
- 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
- name: Extract tag name
id: tag
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
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.tag.outputs.TAG_NAME }}/g" 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
run: python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 19cc928

Please sign in to comment.