Skip to content

Commit de76073

Browse files
committed
Add workflow for pre-commit and uploading to pypi
1 parent 8b77e37 commit de76073

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
9+
10+
jobs:
11+
check-code:
12+
runs-on: ubuntu-24.04
13+
steps:
14+
# This action sets the current path to the root of your github repo
15+
- uses: actions/checkout@v6
16+
17+
- name: Install pre-commit
18+
run: python3 -m pip install pre-commit
19+
20+
- name: Run hooks
21+
run: pre-commit run --all

.github/workflows/pypi.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
tags:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- "main"
12+
13+
14+
jobs:
15+
dist:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- name: Build SDist and wheel
21+
run: pipx run build
22+
23+
- uses: actions/upload-artifact@v5
24+
with:
25+
path: dist/*
26+
27+
- name: Check metadata
28+
run: pipx run twine check dist/*
29+
30+
publish:
31+
needs: [dist]
32+
runs-on: ubuntu-latest
33+
if: startsWith(github.ref, 'refs/tags')
34+
environment: pypi
35+
permissions:
36+
id-token: write
37+
38+
steps:
39+
- uses: actions/download-artifact@v6
40+
with:
41+
name: artifact
42+
path: dist
43+
44+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)