Skip to content

Commit 1bec23c

Browse files
committed
Upgrade the publishing action
1 parent 62d8903 commit 1bec23c

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

.github/workflows/publish.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
name: Publish
2-
on: [push]
3-
2+
on:
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+.[0-9]+'
46
jobs:
57
publish:
68
runs-on: ubuntu-latest
7-
if: startsWith(github.event.ref, 'refs/tags/')
8-
9+
environment:
10+
name: pypi
11+
url: https://pypi.org/p/${{ github.event.repository.name }}
12+
permissions:
13+
id-token: write
914
steps:
10-
- uses: actions/checkout@v3
11-
12-
- name: Set up Python 3.10
13-
uses: actions/setup-python@v4
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
1417
with:
15-
python-version: "3.10"
16-
17-
- name: Check Tag
18-
id: check-release-tag
19-
run: |
20-
if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+(rc[0-9]+|[.]dev[0-9]+)?$ ]]; then
21-
echo ::set-output name=release_tag::true
22-
fi
18+
python-version: 3.13
19+
- run: |
20+
python -m pip install --upgrade build
21+
python -m build
2322
- name: Publish to PyPI
24-
if: steps.check-release-tag.outputs.release_tag == 'true'
25-
run: |
26-
pip install --upgrade setuptools wheel twine
27-
python setup.py sdist bdist_wheel
28-
export TWINE_USERNAME=__token__
29-
export TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
30-
twine upload dist/*
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
password: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)