Skip to content

Commit 76f7f0c

Browse files
authored
fix: add python semantic release (#1)
1 parent 8d05dad commit 76f7f0c

File tree

3 files changed

+38
-28
lines changed

3 files changed

+38
-28
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,36 @@ jobs:
3838
- name: Test with pytest
3939
run: |
4040
pytest --log-cli-level=debug
41+
42+
release:
43+
runs-on: ubuntu-latest
44+
concurrency: release
45+
environment: python-semantic-release
46+
if: github.ref == 'refs/heads/main'
47+
needs: [prek, pytest]
48+
permissions:
49+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
50+
steps:
51+
- name: Generate Token
52+
id: app-token
53+
uses: actions/create-github-app-token@v2.2.1
54+
with:
55+
app-id: ${{ secrets.PSR_APP_ID }}
56+
private-key: ${{ secrets.PSR_PRIVATE_KEY }}
57+
- uses: actions/checkout@v6.0.2
58+
with:
59+
fetch-depth: 0
60+
persist-credentials: false
61+
- name: Set up Python
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: "3.13"
65+
- name: Python Semantic Release
66+
id: release
67+
uses: python-semantic-release/python-semantic-release@v10.5.3
68+
with:
69+
github_token: ${{ steps.app-token.outputs.token }}
70+
changelog: false
71+
- name: Publish package PyPI
72+
uses: pypa/gh-action-pypi-publish@release/v1
73+
if: steps.release.outputs.released == 'true'

.github/workflows/publish-to-pypi.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ select = [
3636
# isort
3737
"I",]
3838

39-
4039
[tool.ruff.lint.mccabe]
4140
max-complexity = 25
4241

@@ -45,3 +44,8 @@ typeCheckingMode = "standard"
4544

4645
[project.optional-dependencies]
4746
dev = ["pytest", "prek"]
47+
48+
[tool.semantic_release]
49+
version_toml = ["pyproject.toml:project.version"]
50+
build_command = "pip install build==1.4.0 && python -m build"
51+
tag_format = "{version}"

0 commit comments

Comments
 (0)