Skip to content

Commit 90bd643

Browse files
committed
workflow: Only publish proper releases to PyPI
Match the tag name against the release only sematic versioning regex for the PyPI upload build step. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 1133776 commit 90bd643

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,21 @@ jobs:
4646
runs-on: ubuntu-latest
4747
if: startsWith(github.ref, 'refs/tags/v')
4848
steps:
49-
- uses: actions/download-artifact@v3
49+
- name: Check if it is a release tag
50+
id: check-tag
51+
run: |
52+
if [[ ${{ github.event.ref }} =~ ^refs/tags/v([0-9]+\.[0-9]+)(-rc[0-9]+)?$ ]]; then
53+
echo ::set-output name=match::true
54+
fi
55+
- name: Download artifiact
56+
uses: actions/download-artifact@v3
57+
if: steps.check-tag.outputs.match == 'true'
5058
with:
5159
name: artifact
5260
path: dist
53-
5461
- name: Publish package to PyPI
5562
uses: pypa/gh-action-pypi-publish@release/v1.5
63+
if: steps.check-tag.outputs.match == 'true'
5664
with:
5765
user: __token__
5866
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)