Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit f589d5c

Browse files
authored
Merge pull request #251 from loftwah/dl/cicd-fix-kamal
fix cicd
2 parents b2d21e3 + 4798659 commit f589d5c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/01.deploy_to_production.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,24 @@ permissions:
66
packages: write
77

88
on:
9-
workflow_dispatch:
109
push:
1110
branches:
1211
- main
1312
workflow_run:
1413
workflows: ["CI"]
14+
branches: [main] # Only run on CI completion for main branch
1515
types:
1616
- completed
1717

1818
jobs:
1919
deploy-production:
2020
name: Deploy to production
21-
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
21+
# Only deploy if either:
22+
# 1. Direct push to main
23+
# 2. CI workflow completed successfully on main branch
24+
if: |
25+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
26+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')
2227
concurrency:
2328
group: production_environment
2429
cancel-in-progress: true
@@ -28,6 +33,8 @@ jobs:
2833
timeout-minutes: 20
2934
steps:
3035
- uses: actions/checkout@v4
36+
with:
37+
ref: main # Explicitly checkout main branch
3138

3239
- uses: ./.github/workflows/setup
3340
name: Setup

0 commit comments

Comments
 (0)