Skip to content

Commit 19cc928

Browse files
authored
Clean up GitHub Action, add manual trigger for testing (#132)
1 parent 80f809c commit 19cc928

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

.github/workflows/publish-to-pypi.yml

+19-12
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,38 @@ on:
44
push:
55
tags:
66
- '*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to publish'
11+
required: true
12+
default: ''
713

814
jobs:
915
build-n-publish:
1016
name: Build and publish Python 🐍 distributions 📦 to PyPI
1117
runs-on: ubuntu-latest
1218
steps:
13-
- uses: actions/checkout@master
19+
- uses: actions/checkout@v3
1420
- name: Set up Python 3.10
1521
uses: actions/setup-python@v3
1622
with:
1723
python-version: '3.10'
1824
- name: Install pypa/setuptools
19-
run: >-
20-
python -m
21-
pip install wheel
22-
- name: Extract tag name
23-
id: tag
24-
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
25+
run: python -m pip install wheel setuptools
26+
- name: Extract tag name or use manual input
27+
id: get_version
28+
run: |
29+
if [[ $GITHUB_REF == refs/tags/* ]]; then
30+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
31+
else
32+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
33+
fi
2534
- name: Update version in setup.py
26-
run: >-
27-
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py
35+
run: sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.get_version.outputs.VERSION }}/g" setup.py
2836
- name: Build a binary wheel
29-
run: >-
30-
python setup.py sdist bdist_wheel
37+
run: python setup.py sdist bdist_wheel
3138
- name: Publish distribution 📦 to PyPI
32-
uses: pypa/gh-action-pypi-publish@master
39+
uses: pypa/gh-action-pypi-publish@v1.8.10
3340
with:
3441
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)