Skip to content

Commit 05dde07

Browse files
jensensclaude
andcommitted
ci: use workflow_run to avoid duplicate test runs in release pipeline
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4f596ad commit 05dde07

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CI
22

33
on:
4+
push:
5+
branches: [main]
46
pull_request:
57
branches: [main]
68
workflow_call:

.github/workflows/release.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: Release
22

33
on:
4-
push:
4+
# Build dev package after CI passes on main (no duplicate test runs)
5+
workflow_run:
6+
workflows: ["CI"]
7+
types: [completed]
58
branches: [main]
69
release:
710
types: [published]
@@ -17,11 +20,11 @@ env:
1720
PYTHON_TARGETS: "-i 3.10 -i 3.11 -i 3.12 -i 3.13 -i 3.14"
1821

1922
jobs:
20-
ci:
21-
uses: ./.github/workflows/ci.yml
22-
2323
linux:
24-
needs: ci
24+
# Skip if triggered by workflow_run and CI failed
25+
if: >-
26+
github.event_name != 'workflow_run' ||
27+
github.event.workflow_run.conclusion == 'success'
2528
runs-on: ${{ matrix.runner }}
2629
strategy:
2730
matrix:
@@ -86,7 +89,7 @@ jobs:
8689
path: dist
8790

8891
macos:
89-
needs: ci
92+
9093
runs-on: ${{ matrix.runner }}
9194
strategy:
9295
matrix:
@@ -130,7 +133,7 @@ jobs:
130133
path: dist
131134

132135
windows:
133-
needs: ci
136+
134137
runs-on: windows-latest
135138
steps:
136139
- uses: actions/checkout@v4
@@ -171,7 +174,7 @@ jobs:
171174
path: dist
172175

173176
sdist:
174-
needs: ci
177+
175178
runs-on: ubuntu-latest
176179
steps:
177180
- uses: actions/checkout@v4
@@ -188,7 +191,7 @@ jobs:
188191
# Upload to Test PyPI on every push to main
189192
release-test-pypi:
190193
name: Publish to test.pypi.org
191-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
194+
if: github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
192195
needs: [linux, macos, windows, sdist]
193196
runs-on: ubuntu-latest
194197
environment: release-test-pypi

0 commit comments

Comments
 (0)