Skip to content

Commit 9b19e7c

Browse files
authored
Create pypi-publish.yml
1 parent 124aa7e commit 9b19e7c

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.x"
28+
29+
- name: build release distribution
30+
run: |
31+
python -m pip install build
32+
python -m build
33+
34+
- name: upload dists
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: release-dists
38+
path: dist/
39+
40+
pypi-publish:
41+
runs-on: ubuntu-latest
42+
needs:
43+
- release-build
44+
permissions:
45+
id-token: write
46+
47+
steps:
48+
- name: Retrieve release distributions
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: release-dists
52+
path: dist/
53+
54+
- name: Publish release distributions to PyPI
55+
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc
56+

0 commit comments

Comments
 (0)