feat: add staging environment
All checks were successful
Build Backend Application and Docker Image / build-docker (push) Successful in 10m26s
Build Backend Application and Docker Image / deploy-stack (push) Successful in 7s

This commit is contained in:
Siwat Sirichai 2025-08-10 18:48:10 +07:00
parent d35a9ae532
commit 57a51f3ba3

View file

@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev
workflow_dispatch:
jobs:
@ -31,7 +32,7 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: git.siwatsystem.com/adsist-cms/worker:latest
tags: git.siwatsystem.com/adsist-cms/worker:${{ github.ref_name == 'main' && 'latest' || 'dev' }}
deploy-stack:
needs: build-docker
@ -48,4 +49,10 @@ jobs:
- name: Deploy stack
run: |
echo "Pulling and starting containers on server..."
ssh -i ~/.ssh/id_rsa ${{ vars.DEPLOY_USER_CMS }}@${{ vars.DEPLOY_HOST_CMS }} "cd ~/cms-system-k8s && docker compose pull && docker compose up -d"
if [ "${{ github.ref_name }}" = "main" ]; then
echo "Deploying production stack..."
ssh -i ~/.ssh/id_rsa ${{ vars.DEPLOY_USER_CMS }}@${{ vars.DEPLOY_HOST_CMS }} "cd ~/cms-system-k8s && docker compose -f docker-compose.production.yml pull && docker compose -f docker-compose.production.yml up -d"
else
echo "Deploying staging stack..."
ssh -i ~/.ssh/id_rsa ${{ vars.DEPLOY_USER_CMS }}@${{ vars.DEPLOY_HOST_CMS }} "cd ~/cms-system-k8s && docker compose -f docker-compose.staging.yml pull && docker compose -f docker-compose.staging.yml up -d"
fi