Replace rsync with git pull in CI workflow
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m46s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m46s
Rsync was leaving dirty working trees on the deploy server, causing git pull conflicts during manual deploys. Use git fetch + reset instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update && apt-get install -y --no-install-recommends openssh-client rsync
|
||||
apt-get update && apt-get install -y --no-install-recommends openssh-client
|
||||
|
||||
- name: Set up SSH
|
||||
env:
|
||||
@@ -28,18 +28,15 @@ jobs:
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
|
||||
- name: Sync code to server
|
||||
- name: Pull latest code on server
|
||||
env:
|
||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||
run: |
|
||||
rsync -avz --delete \
|
||||
--exclude '.git' \
|
||||
--exclude '__pycache__' \
|
||||
--exclude '*.pyc' \
|
||||
--exclude '.pytest_cache' \
|
||||
--exclude 'venv' \
|
||||
--exclude '.env' \
|
||||
./ "root@$DEPLOY_HOST:/root/art-dag/celery/"
|
||||
ssh "root@$DEPLOY_HOST" "
|
||||
cd /root/art-dag/celery
|
||||
git fetch origin main
|
||||
git reset --hard origin/main
|
||||
"
|
||||
|
||||
- name: Build and push image
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user