Skip to content

Commit c085e54

Browse files
Add Python Semantic Release for automated releases (#27)
* Add Python Semantic Release for automated version management - Add python-semantic-release dependency via pixi - Configure PSR in pyproject.toml with version tracking and changelog generation - Update release workflow to use manual dispatch with patch/minor/major options - Run full test suite (linting, type checking, unit tests, integration tests) before release - Use pixi for package management in GitHub Actions - Implement PSR for automated version bumping and tagging - Maintain PyPI trusted publishing for secure releases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Make release workflow DRY by reusing CI workflow - Add workflow_call trigger to CI workflow for reusability - Update integration tests to run on workflow_call events - Release workflow now calls CI workflow instead of duplicating steps - Simplified release job to only handle semantic release and PyPI publishing - Maintains all quality checks while reducing code duplication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 803c2fc commit c085e54

File tree

5 files changed

+1372
-107
lines changed

5 files changed

+1372
-107
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ main, develop ]
66
pull_request:
77
branches: [ main, develop ]
8+
workflow_call:
89

910
jobs:
1011
test:
@@ -57,7 +58,7 @@ jobs:
5758

5859
integration-test:
5960
runs-on: ubuntu-latest
60-
if: github.event_name == 'pull_request'
61+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_call'
6162

6263
steps:
6364
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [created]
4+
workflow_dispatch:
5+
inputs:
6+
level:
7+
description: 'Version level to bump'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
615

716
jobs:
8-
deploy:
9-
runs-on: ubuntu-latest
17+
ci:
18+
uses: ./.github/workflows/ci.yml
19+
secrets: inherit
1020

21+
release:
22+
runs-on: ubuntu-latest
23+
needs: ci
24+
concurrency: release
25+
permissions:
26+
id-token: write
27+
contents: write
28+
1129
steps:
1230
- uses: actions/checkout@v4
13-
14-
- name: Set up Python
15-
uses: actions/setup-python@v5
1631
with:
17-
python-version: '3.12'
32+
fetch-depth: 0
33+
token: ${{ secrets.GITHUB_TOKEN }}
1834

19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install -e ".[dev]"
35+
- name: Install Pixi
36+
uses: prefix-dev/setup-pixi@v0.8.1
37+
with:
38+
pixi-version: v0.29.0
2339

24-
- name: Build package
25-
run: python -m build
40+
- name: Semantic Release
41+
run: pixi run python -m semantic_release version --${{ inputs.level }}
42+
env:
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2644

2745
- name: Publish to PyPI
28-
env:
29-
TWINE_USERNAME: __token__
30-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
31-
run: twine upload dist/*
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
if: github.ref == 'refs/heads/main'

0 commit comments

Comments
 (0)