This commit is contained in:
DatTT127
2026-07-19 18:31:02 +07:00
parent 534724e9d1
commit 3ce9840f19
2 changed files with 19 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ name: Backend EC - Modal Deployment
on:
push:
branches: ['**']
branches: ['main']
workflow_dispatch: {}
permissions:

View File

@@ -2,10 +2,10 @@ name: Deploy CD Server
on:
push:
branches: ['**']
# - main
# paths:
# - 'workspace/sprint_1_2/CODEBASE/deps/implementation/CD_server/**'
branches:
- main
paths:
- 'workspace/sprint_1_2/CODEBASE/deps/implementation/CD_server/**'
jobs:
deploy:
@@ -16,6 +16,20 @@ jobs:
with:
fetch-depth: 1
- name: Prepare VM directories
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.LIGHTSAIL_DEPLOY_HOST }}
username: ${{ secrets.LIGHTSAIL_USERNAME }}
key: ${{ secrets.LIGHTSAIL_SSH_KEY }}
port: ${{ vars.LIGHTSAIL_PORT }}
script: |
set -euo pipefail
DEPLOY_DIR="/opt/cd-server"
sudo mkdir -p "$DEPLOY_DIR"
sudo chown deploy:docker "$DEPLOY_DIR"
echo "[prepare] $DEPLOY_DIR ready"
- name: Copy CD server code to VM
uses: appleboy/scp-action@v0.1.7
with:
@@ -37,12 +51,6 @@ jobs:
script: |
set -euo pipefail
echo "check the surrounding - the current directory"
pwd
echo "check the surrounding"
ls -la
ls -la /opt/cd-server || true
DEPLOY_DIR="/opt/cd-server"
SERVICE_NAME="cd-server"