Skip to content

Commit bda0630

Browse files
committed
Move publish to workflow_run after CI success
Remove the inline publish job from the main CI workflow and convert the publish workflow into a separate workflow_run that triggers when the CI workflow completes on the main branch. Add a guard to run only on successful CI runs, use the workflow_run head_sha for checkout, and simplify the paths-filter base to HEAD^. These changes decouple publishing from the main CI job and ensure the publish workflow runs against the exact commit that finished the CI.
1 parent eccdbc3 commit bda0630

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,3 @@ jobs:
2929

3030
- name: Build
3131
run: yarn build
32-
33-
publish:
34-
needs: check-lint-test-build
35-
if: github.ref == 'refs/heads/main'
36-
uses: ./.github/workflows/publish.yml

.github/workflows/publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
name: Publish
22

33
on:
4-
workflow_call:
4+
workflow_run:
5+
workflows: [CI]
6+
types: [completed]
7+
branches: [main]
58

69
jobs:
710
publish:
11+
if: github.event.workflow_run.conclusion == 'success'
812
runs-on: ubuntu-22.04
913
steps:
1014
- name: Checkout repository
1115
uses: actions/checkout@v6
1216
with:
17+
ref: ${{ github.event.workflow_run.head_sha }}
1318
fetch-depth: 0
1419

1520
- name: Detect changed packages
1621
id: changes
1722
uses: dorny/paths-filter@v3
1823
with:
19-
base: ${{ github.event.before || 'HEAD^' }}
24+
base: HEAD^
2025
filters: |
2126
utils:
2227
- 'packages/utils/**'

0 commit comments

Comments
 (0)