Skip to content

Commit

Permalink
fix cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Dec 10, 2024
1 parent b2d21e3 commit 4798659
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/01.deploy_to_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ permissions:
packages: write

on:
workflow_dispatch:
push:
branches:
- main
workflow_run:
workflows: ["CI"]
branches: [main] # Only run on CI completion for main branch
types:
- completed

jobs:
deploy-production:
name: Deploy to production
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
# Only deploy if either:
# 1. Direct push to main
# 2. CI workflow completed successfully on main branch
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')
concurrency:
group: production_environment
cancel-in-progress: true
Expand All @@ -28,6 +33,8 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
ref: main # Explicitly checkout main branch

- uses: ./.github/workflows/setup
name: Setup
Expand Down

0 comments on commit 4798659

Please sign in to comment.