-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (49 loc) · 1.61 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node_modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Generating the site
run: npm run docs:build
- name: Cleaning up the site directory before deployment
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_SERVER_IP }}
port: ${{ secrets.SSH_SERVER_PORT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd ${{ secrets.SITE_DIR }}
rm -rf *
- name: Deploying the site
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.SSH_SERVER_IP }}
REMOTE_USER: ${{ secrets.SSH_USER }}
REMOTE_PORT: ${{ secrets.SSH_SERVER_PORT }}
SOURCE: "docs/.vitepress/dist/"
TARGET: ${{ secrets.SITE_DIR }}
- name: Clearing the Cloudflare cache
uses: jakejarvis/cloudflare-purge-action@master
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}