Skip to content

Commit a622f73

Browse files
committed
ci(release): integrate python-semantic-release for automated releases
Add semantic release config to pyproject.toml and a CD workflow that triggers after CI passes on main. Automates version bumping, changelog generation, git tagging, and GitHub Release creation.
1 parent 955fd7f commit a622f73

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/workflows/cd.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CD
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-latest
16+
if: >-
17+
github.event.workflow_run.conclusion == 'success' &&
18+
github.event.workflow_run.event == 'push'
19+
concurrency:
20+
group: release-${{ github.ref_name }}
21+
cancel-in-progress: false
22+
permissions:
23+
contents: write
24+
id-token: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.ref_name }}
29+
fetch-depth: 0
30+
- run: git reset --hard ${{ github.event.workflow_run.head_sha }}
31+
- uses: astral-sh/setup-uv@v4
32+
- run: uv python install 3.12
33+
- id: release
34+
uses: python-semantic-release/python-semantic-release@v10.5.3
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
git_committer_name: "github-actions"
38+
git_committer_email: "actions@users.noreply.github.com"
39+
- uses: python-semantic-release/publish-action@v10.5.3
40+
if: steps.release.outputs.released == 'true'
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
tag: ${{ steps.release.outputs.tag }}

pyproject.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,32 @@ ignore = [
7575
[tool.ruff.format]
7676
quote-style = "double"
7777
indent-style = "space"
78+
79+
[tool.semantic_release]
80+
commit_parser = "conventional"
81+
allow_zero_version = true
82+
tag_format = "v{version}"
83+
build_command = "uv build"
84+
version_variables = [
85+
"src/omnifocus_mcp/__init__.py:__version__",
86+
]
87+
commit_message = "chore(release): v{version} [skip ci]"
88+
89+
[tool.semantic_release.changelog]
90+
mode = "update"
91+
exclude_commit_patterns = [
92+
'''Merge pull request.*''',
93+
'''chore\(deps\):.*''',
94+
]
95+
96+
[tool.semantic_release.changelog.default_templates]
97+
changelog_file = "CHANGELOG.md"
98+
output_format = "md"
99+
mask_initial_release = false
100+
101+
[tool.semantic_release.remote]
102+
type = "github"
103+
104+
[tool.semantic_release.publish]
105+
upload_to_vcs_release = true
106+
dist_glob_patterns = ["dist/*"]

0 commit comments

Comments
 (0)