Skip to content

Commit 198f252

Browse files
Add GitHub Actions workflow for PyPI publishing
1 parent a70e516 commit 198f252

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Publishes to TestPyPI when you push a tag starting with "test-v"
2+
on:
3+
push:
4+
tags:
5+
- "test-v*"
6+
7+
# Publishes to real PyPI when you create a proper GitHub release
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
- run: pip install build
22+
- run: python -m build
23+
24+
- name: Publish to TestPyPI
25+
if: startsWith(github.ref, 'refs/tags/test-v')
26+
uses: pypa/gh-action-pypi-publish@release/v1
27+
with:
28+
repository-url: https://test.pypi.org/legacy/
29+
30+
- name: Publish to PyPI
31+
if: github.event_name == 'release'
32+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)