Skip to content

Commit 0f241cd

Browse files
committed
Add github action to publish to pypi package
Signed-off-by: Tim Li <ltim@uber.com>
1 parent 4145d5d commit 0f241cd

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This workflow will upload a Python Package to PyPI 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+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release-build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
enable-cache: true
24+
cache-dependency-glob: "uv.lock"
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version-file: "pyproject.toml"
30+
31+
- name: Build release distributions
32+
run: uv build
33+
34+
- name: Upload distributions
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+
# IMPORTANT: this permission is mandatory for trusted publishing
46+
id-token: write
47+
48+
# Dedicated environments with protections for publishing are strongly recommended.
49+
environment:
50+
name: pypi
51+
url: https://pypi.org/p/cadence-python-client
52+
53+
steps:
54+
- name: Retrieve release distributions
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: release-dists
58+
path: dist/
59+
60+
- name: Publish release distributions to PyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)