Skip to content

Commit d98bafa

Browse files
authored
Update python-publish.yml
1 parent 95d3b7d commit d98bafa

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

.github/workflows/python-publish.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Upload Python Package
9+
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
1010

11-
on:
12-
[push]
11+
on: push
1312

1413
permissions:
1514
contents: read
1615

1716
jobs:
1817
deploy:
19-
18+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2019
runs-on: ubuntu-latest
2120

2221
steps:
@@ -25,13 +24,31 @@ jobs:
2524
uses: actions/setup-python@v3
2625
with:
2726
python-version: '3.x'
28-
- name: Install dependencies
27+
- name: Install pip
2928
run: |
3029
python -m pip install --upgrade pip
31-
pip install build
32-
- name: Build package
33-
run: python -m build
34-
- name: Publish package
30+
- name: Install pypa/build
31+
run: >-
32+
python -m
33+
pip install
34+
build
35+
--user
36+
- name: Build a binary wheel and a source tarball
37+
run: >-
38+
python -m
39+
build
40+
--sdist
41+
--wheel
42+
--outdir dist/
43+
.
44+
- name: Publish distribution 📦 to Test PyPI
45+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
46+
with:
47+
user: __token__
48+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
49+
repository_url: https://test.pypi.org/legacy/
50+
- name: Publish distribution 📦 to PyPI
51+
if: startsWith(github.ref, 'refs/tags')
3552
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
3653
with:
3754
user: __token__

0 commit comments

Comments
 (0)