aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/deploy.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/deploy.yml')
-rw-r--r--.github/workflows/deploy.yml18
1 files changed, 15 insertions, 3 deletions
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 88671f7..2099d29 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -25,23 +25,35 @@ jobs:
npm ci
npm run build # Vite’s default output dir is `dist/`
- # 4) Copy build output to VPS via SCP
+ # 4) Clean remote dir
+ - name: Clean remote directory
+ uses: appleboy/ssh-action@master
+ with:
+ host: ${{ secrets.VPS_HOST }}
+ username: ${{ secrets.VPS_USER }}
+ key: ${{ secrets.VPS_SSH_KEY }}
+ port: ${{ secrets.VPS_PORT }}
+ script: |
+ rm -rf ${{ secrets.VPS_DESTINATION }}/*
+
+ # 5) Copy build output to VPS via SCP
- name: Deploy build via SCP
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
- port: 22
+ port: ${{ secrets.VPS_PORT }}
source: "dist/*"
target: ${{ secrets.VPS_DESTINATION }}
- # 5) Restart Nginx inside Docker on your VPS
+ # 6) Restart Nginx inside Docker on your VPS
- name: Restart Nginx (Docker)
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
+ port: ${{ secrets.VPS_PORT }}
script: |
docker restart nginx