From 3ce9840f191041d5838dfe6e11be6b45c0150b7c Mon Sep 17 00:00:00 2001 From: DatTT127 Date: Sun, 19 Jul 2026 18:31:02 +0700 Subject: [PATCH] update --- .gitea/workflows/backend-ecr-modal.yaml | 2 +- .gitea/workflows/deploy-cd-server.yaml | 28 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/backend-ecr-modal.yaml b/.gitea/workflows/backend-ecr-modal.yaml index 75f809e..201aa6c 100644 --- a/.gitea/workflows/backend-ecr-modal.yaml +++ b/.gitea/workflows/backend-ecr-modal.yaml @@ -5,7 +5,7 @@ name: Backend EC - Modal Deployment on: push: - branches: ['**'] + branches: ['main'] workflow_dispatch: {} permissions: diff --git a/.gitea/workflows/deploy-cd-server.yaml b/.gitea/workflows/deploy-cd-server.yaml index d2fdcf1..92b9859 100644 --- a/.gitea/workflows/deploy-cd-server.yaml +++ b/.gitea/workflows/deploy-cd-server.yaml @@ -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"