Skip to content

Commit 5596151

Browse files
authored
Publish prereleases to staging PyPI
1 parent bc427ed commit 5596151

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: Publish Package to PyPi
52

63
on:
74
release:
8-
types: [created]
5+
types: [released, prereleased]
96

107
jobs:
118
deploy:
@@ -21,10 +18,19 @@ jobs:
2118
- name: Install dependencies
2219
run: |
2320
python -m pip install --upgrade pip
24-
pip install setuptools wheel
21+
pip install build
2522
- name: Build
26-
run: python setup.py sdist bdist_wheel
23+
run: |
24+
python -m build
25+
- name: Publish to PyPI Staging
26+
if: "github.event.release.prerelease"
27+
uses: pypa/gh-action-pypi-publish@release/v1
28+
with:
29+
user: '__token__'
30+
password: ${{ secrets.TEST_PYPI_TOKEN }}
31+
repository_url: https://test.pypi.org/legacy/
2732
- name: Publish to PyPI
33+
if: "!github.event.release.prerelease"
2834
uses: pypa/gh-action-pypi-publish@release/v1
2935
with:
3036
user: '__token__'

0 commit comments

Comments
 (0)