Skip to content

Commit e618a6a

Browse files
authored
ci: add aggregator checks and wire release publish (#19)
* ci: squash release-please PRs and auto-publish to PyPI - release-please-config.json: set merge-type to squash - publish.yml: convert push:tags trigger to workflow_call (with optional workflow_dispatch ref input) so release-please can chain it - release-please.yml: add publish job that calls publish.yml when release_created is true. GITHUB_TOKEN-pushed tags do not trigger downstream workflows, so chaining is required. * ci: add aggregator checks and wire release publish Add stable aggregator jobs (CI, PR Title Lint) for branch protection required status checks, independent of matrix/job name changes. Run ci on all PRs. Make publish.yml callable via workflow_call/dispatch with a ref input, and trigger it from release-please on release creation.
1 parent a5561dd commit e618a6a

5 files changed

Lines changed: 63 additions & 7 deletions

File tree

.github/workflows/check-pr.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,20 @@ jobs:
3939
Subject must start with lowercase letter and not end with a period.
4040
Got: "{subject}"
4141
wip: true
42+
43+
# Aggregator job: a single, stable check-run name to use as the required
44+
# status check in branch protection, independent of the underlying job name.
45+
pr-title-lint:
46+
name: PR Title Lint
47+
needs: [conventional-title]
48+
runs-on: ubuntu-latest
49+
if: always()
50+
steps:
51+
- name: Verify PR title lint did not fail
52+
run: |
53+
# Fail only on failure/cancelled; a skipped run is allowed.
54+
result="${{ needs.conventional-title.result }}"
55+
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
56+
echo "PR title lint did not pass: $result"
57+
exit 1
58+
fi

.github/workflows/ci.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87
workflow_dispatch:
98

109
env:
@@ -68,4 +67,23 @@ jobs:
6867
run: uv sync --all-groups
6968

7069
- name: Run tests
71-
run: uv run tox -e py${{ matrix.python-version }}
70+
run: uv run tox -e py${{ matrix.python-version }}
71+
72+
# Aggregator job: a single, stable check-run name to use as the required
73+
# status check in branch protection. Stays valid even if the matrix or the
74+
# individual job names change.
75+
ci:
76+
name: CI
77+
needs: [quality-checks, test]
78+
runs-on: ubuntu-latest
79+
if: always()
80+
steps:
81+
- name: Verify no upstream job failed
82+
run: |
83+
# Fail only on failure/cancelled. A skipped job is allowed
84+
for result in "${{ needs.quality-checks.result }}" "${{ needs.test.result }}"; do
85+
if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then
86+
echo "An upstream job did not pass: quality-checks=${{ needs.quality-checks.result }} test=${{ needs.test.result }}"
87+
exit 1
88+
fi
89+
done

.github/workflows/publish.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ name: Publish to PyPI
22

33
on:
44
workflow_dispatch:
5-
push:
6-
tags:
7-
- "v[0-9]+.[0-9]+.[0-9]+*"
5+
inputs:
6+
ref:
7+
description: "Git ref to build and publish"
8+
type: string
9+
required: false
10+
workflow_call:
11+
inputs:
12+
ref:
13+
description: "Git ref to build and publish"
14+
type: string
15+
required: true
816

917
env:
1018
UV_VERSION: "0.11.6"
@@ -24,7 +32,7 @@ jobs:
2432
- name: Checkout code
2533
uses: actions/checkout@v4
2634
with:
27-
ref: ${{ github.ref }}
35+
ref: ${{ inputs.ref || github.ref }}
2836

2937
- name: Install uv
3038
uses: astral-sh/setup-uv@v6

.github/workflows/release-please.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release Please
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [main, master]
66
workflow_dispatch:
77

88
permissions:
@@ -69,3 +69,15 @@ jobs:
6969
git add uv.lock
7070
git commit -m "chore: refresh uv.lock for release"
7171
git push
72+
73+
publish:
74+
name: Publish to PyPI
75+
needs: release-please
76+
if: ${{ needs.release-please.outputs.release_created }}
77+
permissions:
78+
id-token: write
79+
contents: read
80+
uses: ./.github/workflows/publish.yml
81+
with:
82+
ref: ${{ needs.release-please.outputs.tag_name }}
83+
secrets: inherit

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"merge-type": "squash",
23
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
34
"packages": {
45
".": {

0 commit comments

Comments
 (0)