Skip to content

Commit 854ec22

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

2 files changed

Lines changed: 71 additions & 1 deletion

File tree

.github/workflows/publish.yaml

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

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@ repos:
8080
- repo: "https://github.com/zizmorcore/zizmor-pre-commit"
8181
rev: "e3eebf65325ccc992422292cb7a4baee967cf815" # frozen: v1.26.1
8282
hooks:
83-
- id: "zizmor"
83+
- id: "zizmor"
84+
args:
85+
- "--persona=pedantic"

0 commit comments

Comments
 (0)