Skip to content

Commit f2f2a47

Browse files
committed
Add a publishing workflow
1 parent 3e47f55 commit f2f2a47

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: '📦 Publish'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'releases'
7+
8+
permissions: {}
9+
env:
10+
PACKAGES_PATH: 'dist'
11+
12+
jobs:
13+
build:
14+
outputs:
15+
artifact-id: "${{ steps.upload-packages.outputs.artifact-id }}"
16+
17+
name: 'Build'
18+
runs-on: 'ubuntu-24.04'
19+
steps:
20+
- name: 'Checkout'
21+
uses: 'actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0' # v7.0.0
22+
with:
23+
persist-credentials: 'false'
24+
25+
- name: 'Setup Python'
26+
uses: 'actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1' # v6.3.0
27+
with:
28+
python-version: '3.14'
29+
30+
- name: 'Build'
31+
run: |
32+
python -m venv .venv
33+
source .venv/bin/activate
34+
python -m pip install build
35+
python -m build --outdir dist/
36+
37+
- name: 'Upload packages'
38+
id: 'upload-packages'
39+
uses: 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a' # v7.0.1
40+
with:
41+
path: "${{ env.PACKAGES_PATH }}"
42+
43+
44+
publish:
45+
needs:
46+
- 'build'
47+
environment: 'PyPI'
48+
permissions:
49+
id-token: 'write'
50+
51+
name: 'Publish'
52+
runs-on: 'ubuntu-24.04'
53+
steps:
54+
- name: 'Download the built packages'
55+
uses: 'actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c' # v8.0.1
56+
with:
57+
artifact-ids: "${{ needs.build.outputs.artifact-id }}"
58+
path: "${{ env.PACKAGES_PATH }}"
59+
60+
- name: 'Publish package distributions to PyPI'
61+
uses: 'pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b' # v1.14.0
62+
with:
63+
packages-dir: "${{ env.PACKAGES_PATH }}"

0 commit comments

Comments
 (0)