From 9b361aa16951e0c7d2ca9c5e95ad0ae6f86af0b7 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 27 May 2026 15:47:24 +0300 Subject: [PATCH] Refactor deployment script for cloud-pc to remove unnecessary SSH command and streamline stack deployment process --- .gitea/workflows/deploy-cloud-pc.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/deploy-cloud-pc.yml b/.gitea/workflows/deploy-cloud-pc.yml index 5996ddf..58a8b9a 100644 --- a/.gitea/workflows/deploy-cloud-pc.yml +++ b/.gitea/workflows/deploy-cloud-pc.yml @@ -14,18 +14,17 @@ jobs: fetch-depth: 2 - name: Deploy changed stacks run: | - ssh -o StrictHostKeyChecking=no ${{ secrets.CLOUD-PC_USER }}@${{ secrets.CLOUD-PC_HOST }} << 'ENDSSH' + cd /opt/services + git pull + for dir in $(git diff --name-only HEAD~1 HEAD | grep '^cloud-pc/' | cut -d/ -f2 | sort -u); do + echo "==> Deploying $dir" + cd /opt/services/cloud-pc/$dir + test -f docker-compose.yml || { echo "No docker-compose.yml in $dir, skipping"; cd /opt/services; continue; } + if grep -qE '^[[:space:]]*build:' docker-compose.yml; then + docker compose up -d --build --remove-orphans + else + docker compose pull + docker compose up -d --remove-orphans + fi cd /opt/services - git pull - for dir in $(git diff --name-only HEAD~1 HEAD | grep '^cloud-pc/' | cut -d/ -f2 | sort -u); do - echo "==> Deploying $dir" - cd /opt/services/cloud-pc/$dir - if grep -qE '^[[:space:]]*build:' docker-compose.yml; then - docker compose up -d --build --remove-orphans - else - docker compose pull - docker compose up -d --remove-orphans - fi - cd /opt/services - done - ENDSSH + done