Skip to content

Commit a2cc324

Browse files
Update publish.yml
1 parent fd24bcb commit a2cc324

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
name: Upload Python Package
1+
name: Publish on Tag
22

33
on:
4-
release:
5-
types: [published]
6-
7-
permissions:
8-
contents: read
4+
push:
5+
tags:
6+
- 'v*'
97

108
jobs:
11-
deploy:
9+
publish:
1210
runs-on: ubuntu-latest
11+
1312
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python
16-
uses: actions/setup-python@v3
17-
with:
18-
python-version: '3.x'
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install build
23-
- name: Build package
24-
run: python -m build
25-
- name: Publish package
26-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
27-
with:
28-
user: __token__
29-
password: ${{ secrets.PYPI_API_TOKEN }}
13+
- name: Check out code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python 3.9
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- name: Install build & upload tools
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install "setuptools<61" wheel build twine
25+
26+
- name: Build distributions
27+
run: |
28+
rm -rf build/ dist/ *.egg-info
29+
python -m build
30+
31+
- name: Publish to PyPI
32+
env:
33+
TWINE_USERNAME: __token__
34+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
35+
run: |
36+
twine upload dist/*

0 commit comments

Comments
 (0)