Skip to content

Commit d3068b1

Browse files
chore: add github actions for pr quality gate and auto-release
1 parent b4ad67f commit d3068b1

File tree

4 files changed

+603
-0
lines changed

4 files changed

+603
-0
lines changed

.github/workflows/pr_quality.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PR Quality Gate
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
validate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v5
15+
16+
- name: Set up Python
17+
run: uv python install 3.12
18+
19+
- name: Install dependencies
20+
run: uv sync --all-extras --dev
21+
22+
- name: Lint and Format Check
23+
run: uv run poe check
24+
25+
- name: Run Tests with Coverage
26+
run: uv run poe test

.github/workflows/release.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Auto Release & Publish
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write # MANDATORY for PyPI Trusted Publishing
12+
contents: write # MANDATORY for Semantic Release to push tags/commits
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # Required to read the git commit history
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
22+
- name: Set up Python
23+
run: uv python install 3.12
24+
25+
- name: Python Semantic Release
26+
id: semantic
27+
uses: python-semantic-release/python-semantic-release@v9
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# The step above automatically runs `uv build` (because we set it in pyproject.toml)
32+
# BUT it only does this IF there are commits that trigger a release (feat:, fix:, etc.)
33+
34+
- name: Publish to PyPI
35+
if: steps.semantic.outputs.released == 'true'
36+
run: uv publish

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dev = [
2929
"pre-commit>=4.5.1",
3030
"pytest>=9.0.2",
3131
"pytest-cov>=7.0.0",
32+
"python-semantic-release>=10.5.3",
3233
"ruff>=0.15.2",
3334
]
3435

@@ -42,3 +43,9 @@ clean = """
4243
rm -rf .venv .ruff_cache .pytest_cache .coverage htmlcov dist build *.egg-info
4344
"""
4445
lint = ["fix", "format"]
46+
47+
[tool.semantic_release]
48+
version_toml = ["pyproject.toml:project.version"]
49+
branch = "master"
50+
build_command = "uv build"
51+
commit_message = "chore(release): {version} [skip ci]"

0 commit comments

Comments
 (0)