Skip to content

Commit 193d1f6

Browse files
ryjonesclaude
andcommitted
Add PyPI trusted publishing workflow
Publishes sdist and wheel to PyPI via OIDC trusted publishing when a release tag (e.g. 0.16.1) is pushed. Build and publish run as separate jobs so id-token: write is scoped to the publish job only, and all actions are pinned to the commit SHA of their latest release. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Ry Jones <ry@linux.com>
1 parent 67dbaea commit 193d1f6

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/publish_pypi.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
19+
with:
20+
version: "latest"
21+
22+
- name: Build sdist and wheel
23+
run: uv build
24+
25+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
26+
with:
27+
name: dist
28+
path: dist/
29+
30+
publish:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/project/liboqs-python/
36+
permissions:
37+
id-token: write
38+
39+
steps:
40+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
41+
with:
42+
name: dist
43+
path: dist/
44+
45+
- name: Publish to PyPI
46+
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1

0 commit comments

Comments
 (0)