From 9b0c1ee1178c2662e28c8b9844ca6343f9b83ed3 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Mon, 7 Jul 2025 23:31:04 +0900 Subject: [PATCH] Use temporary directory for safe deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Extract files to /tmp first to avoid permission issues - Use sudo rsync --delete for clean deployment - Remove temporary files after deployment - Handles root-owned files in target directory 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bb363e2..6158c02 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,10 +46,10 @@ jobs: ssh -p ${{ secrets.NAS_PORT }} admin@${{ secrets.NAS_HOST }} \ "which rsync && rsync --version" - - name: Clean and deploy via tar and SSH + - name: Deploy to temporary location and move run: | tar czf - --exclude='.git' . | ssh -p ${{ secrets.NAS_PORT }} admin@${{ secrets.NAS_HOST }} \ - "rm -rf /volume1/homes/admin/nginx-infra/* && cd /volume1/homes/admin/nginx-infra && tar xzf -" + "mkdir -p /tmp/nginx-infra-deploy && cd /tmp/nginx-infra-deploy && tar xzf - && sudo rsync -av --delete /tmp/nginx-infra-deploy/ /volume1/homes/admin/nginx-infra/ && rm -rf /tmp/nginx-infra-deploy" - name: Check Docker permissions run: |