Skip to content

Commit fefad2a

Browse files
lkronecker13claude
andcommitted
fix: consolidate GitHub Actions workflows to fix release trigger
- Replace separate feature.yaml and main.yaml with unified ci.yml - Fix release job not triggering on PR merge by adding closed event - Add semantic PR validation for conventional commits - Update to astral-sh/setup-uv@v3 for better compatibility - Configure release job to trigger on both merged PRs and main pushes - Add merged-test job to verify PR merge commits This ensures releases are properly triggered when PRs are merged to main and maintains CI/CD pipeline functionality for all development workflows. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8e0ffad commit fefad2a

File tree

3 files changed

+135
-188
lines changed

3 files changed

+135
-188
lines changed

.github/workflows/ci.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches: ["main"]
9+
types: [opened, synchronize, reopened, closed]
10+
11+
permissions:
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
semantic-pr:
17+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: amannn/action-semantic-pull-request@v5
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
lint:
25+
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.action != 'closed')
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v3
32+
with:
33+
enable-cache: true
34+
cache-dependency-glob: |
35+
pyproject.toml
36+
*.py
37+
38+
- name: Set up Python
39+
run: uv python install 3.12
40+
41+
- name: Install dependencies
42+
run: uv sync --all-extras --dev
43+
44+
- name: Run linters
45+
run: uv run ruff check .
46+
47+
test:
48+
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.action != 'closed')
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Install uv
54+
uses: astral-sh/setup-uv@v3
55+
with:
56+
enable-cache: true
57+
cache-dependency-glob: |
58+
pyproject.toml
59+
*.py
60+
61+
- name: Set up Python
62+
run: uv python install 3.12
63+
64+
- name: Install dependencies
65+
run: uv sync --all-extras --dev
66+
67+
- name: Run tests
68+
run: uv run pytest
69+
70+
merged-test:
71+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
with:
76+
ref: ${{ github.event.pull_request.merge_commit_sha }}
77+
fetch-depth: 0
78+
79+
- name: Install uv
80+
uses: astral-sh/setup-uv@v3
81+
with:
82+
enable-cache: true
83+
cache-dependency-glob: |
84+
pyproject.toml
85+
*.py
86+
87+
- name: Set up Python
88+
run: uv python install 3.12
89+
90+
- name: Install dependencies
91+
run: uv sync --all-extras --dev
92+
93+
- name: Run tests
94+
run: uv run pytest
95+
96+
release:
97+
needs: [lint, test]
98+
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event.action == 'closed' && github.event.pull_request.merged == true)
99+
runs-on: ubuntu-latest
100+
permissions:
101+
contents: write
102+
steps:
103+
- uses: actions/checkout@v4
104+
with:
105+
fetch-depth: 0
106+
token: ${{ secrets.RELEASE_TOKEN }}
107+
108+
- name: Install uv
109+
uses: astral-sh/setup-uv@v3
110+
with:
111+
enable-cache: true
112+
cache-dependency-glob: |
113+
pyproject.toml
114+
*.py
115+
116+
- name: Set up Python
117+
run: uv python install 3.12
118+
119+
- name: Install dependencies
120+
run: |
121+
uv sync --all-extras --dev
122+
uv pip install python-semantic-release
123+
124+
- name: Configure Git
125+
run: |
126+
git config user.name "GitHub Actions"
127+
git config user.email "actions@github.com"
128+
129+
- name: Bump version and publish release
130+
env:
131+
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
132+
run: |
133+
uv run semantic-release version
134+
git push --follow-tags origin ${{ github.ref_name }}
135+
uv run semantic-release publish

.github/workflows/feature.yaml

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

.github/workflows/main.yaml

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

0 commit comments

Comments
 (0)