Skip to content

Commit 0f979c4

Browse files
authored
Merge pull request #8 from coundia/dev
dev
2 parents f25f48d + 670082d commit 0f979c4

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/deploy.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
name: astro-build
3737
path: dist/
3838

39-
- name: Deploy to test OVH Server
39+
- name: Deploy to prod OVH Server
4040
env:
4141
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
4242
SERVER_USER: ${{ secrets.SERVER_USER }}
@@ -48,18 +48,22 @@ jobs:
4848
echo "Error: Missing environment variables!"
4949
exit 1
5050
fi
51-
51+
5252
# Configure SSH for access
5353
mkdir -p ~/.ssh
5454
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | tee ~/.ssh/id_rsa > /dev/null
5555
chmod 600 ~/.ssh/id_rsa
5656
ssh-keyscan -H "$SERVER_IP" >> ~/.ssh/known_hosts
57-
57+
5858
# Test SSH connection
5959
ssh -o StrictHostKeyChecking=no "$SERVER_USER@$SERVER_IP" "echo 'SSH connection successful'"
6060
61-
# Deploy to the test server
62-
rsync -avz --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH"
61+
# Clear target directory on the server (optional but recommended)
62+
ssh "$SERVER_USER@$SERVER_IP" "rm -rf $SERVER_PATH/*"
63+
64+
# Deploy to the production server
65+
rsync -avzL --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH" -v
66+
6367

6468
selenium-test:
6569
runs-on: ubuntu-latest
@@ -112,15 +116,19 @@ jobs:
112116
echo "Error: Missing environment variables!"
113117
exit 1
114118
fi
115-
119+
116120
# Configure SSH for access
117121
mkdir -p ~/.ssh
118122
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | tee ~/.ssh/id_rsa > /dev/null
119123
chmod 600 ~/.ssh/id_rsa
120124
ssh-keyscan -H "$SERVER_IP" >> ~/.ssh/known_hosts
121-
125+
122126
# Test SSH connection
123127
ssh -o StrictHostKeyChecking=no "$SERVER_USER@$SERVER_IP" "echo 'SSH connection successful'"
124128
129+
# Clear target directory on the server (optional but recommended)
130+
ssh "$SERVER_USER@$SERVER_IP" "rm -rf $SERVER_PATH/*"
131+
125132
# Deploy to the production server
126-
rsync -avz --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH"
133+
rsync -avzL --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH" -v
134+

0 commit comments

Comments
 (0)