Skip to content

Commit 5c0e220

Browse files
committed
Improve CD workflow to allow push/manual triggers
1 parent a833a20 commit 5c0e220

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/cd.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
name: Continuous Deployment
22

33
on:
4+
# 1️⃣ Automatically trigger after CI passes (only for main)
45
workflow_run:
56
workflows: ["Continuous Integration"]
67
types:
78
- completed
89
branches:
910
- main
10-
- 'feature/*'
11-
workflow_dispatch: # allows manual deploys
11+
12+
# 2️⃣ Fallback: trigger on push (for non-main or if CI doesn’t exist)
13+
push:
14+
branches:
15+
- main
16+
- feature/** # optional — allow testing on feature branches
17+
# - dev # optional — allow dev environment deploys
18+
19+
# 3️⃣ Manual trigger anytime
20+
workflow_dispatch:
1221

1322
jobs:
1423
deploy:
15-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
24+
# Only run auto-deploy if CI passed OR triggered manually/push
25+
if: >
26+
github.event_name == 'workflow_dispatch' ||
27+
github.event_name == 'push' ||
28+
(github.event_name == 'workflow_run' &&
29+
github.event.workflow_run.conclusion == 'success')
30+
1631
runs-on: ubuntu-latest
1732

1833
steps:

0 commit comments

Comments
 (0)