-
Notifications
You must be signed in to change notification settings - Fork 3
45 lines (42 loc) · 1.26 KB
/
docs.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
name: docs
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
+(docs|docs-vuepress|example)/**/*
+(docs|docs-vuepress|example)/.*/**/*
- uses: actions/setup-node@v1
with:
node-version: '16'
- uses: pnpm/action-setup@v2
if: env.GIT_DIFF
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
# vuepress生成最终文档
- name: generate docs file
if: env.GIT_DIFF
run: |
pnpm run docs:prod
# 使用 https://github.com/appleboy/scp-action 进行部署,注意 strip_components 用于控制层级
- name: Deploy to self-host server
if: env.GIT_DIFF
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DOCS_SERVER_HOST }}
username: ${{ secrets.DOCS_SERVER_USER }}
key: ${{ secrets.DOCS_SERVER_KEY }}
command_timeout: "20m"
source: "./docs/.vuepress/dist/"
strip_components: 4
target: "${{ secrets.DOCS_SERVER_DIR }}"