Skip to content

Commit 0536b56

Browse files
committed
chore: PyPI & GitHub release
1 parent f443b53 commit 0536b56

File tree

1 file changed

+45
-10
lines changed

1 file changed

+45
-10
lines changed

.github/workflows/publish.yml

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
name: "Publish"
1+
name: Release
22

33
on:
4-
release:
5-
types: ["published"]
4+
push:
5+
tags:
6+
- "v*" # Triggers on version tags
67

78
jobs:
8-
run:
9-
name: "Build and publish release"
9+
build:
1010
runs-on: ubuntu-latest
11-
1211
steps:
1312
- uses: actions/checkout@v4
1413

@@ -19,10 +18,46 @@ jobs:
1918
cache-dependency-glob: uv.lock
2019

2120
- name: Set up Python
22-
run: uv python install 3.12 # Or whatever version I want to use.
21+
run: uv python install 3.11
2322

24-
- name: Build
23+
- name: Build package
2524
run: uv build
2625

27-
- name: Publish
28-
run: uv publish -t ${{ secrets.PYPI_TOKEN }}
26+
- name: Upload build artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: dist
30+
path: dist/
31+
32+
publish-pypi:
33+
needs: build
34+
runs-on: ubuntu-latest
35+
permissions:
36+
id-token: write # For trusted publishing
37+
steps:
38+
- uses: actions/download-artifact@v4
39+
with:
40+
name: dist
41+
path: dist/
42+
43+
- name: Publish to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1
45+
46+
github-release:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
permissions:
50+
contents: write
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- uses: actions/download-artifact@v4
55+
with:
56+
name: dist
57+
path: dist/
58+
59+
- name: Create GitHub Release
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
files: dist/*
63+
generate_release_notes: true

0 commit comments

Comments
 (0)