-
Notifications
You must be signed in to change notification settings - Fork 93
53 lines (47 loc) · 1.57 KB
/
main.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
name: docs build
on:
push:
branches:
# 确保这是你正在使用的分支名称
- blog
jobs:
LearnData-build:
runs-on: ubuntu-latest
env:
FTP_HOST: ${{ secrets.ftp_host_blog }}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
# 获取所有标记和分支的所有历史记录(updatetime 必须,否则每次都会变化)
fetch-depth: 0
# 如果文档包含 Git 子模块,请取消注释下一行
# submodules: true
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
run_install: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
# 复制读书笔记到静态页面路径,并构建页面
- name: Build Docs
env:
NODE_OPTIONS: --max_old_space_size=8192
run: |-
pnpm cpx "docs/reading/**" docs/.vuepress/public/reading
pnpm run docs:build
> docs/.vuepress/dist/.nojekyll
# 如果配置了 FTP 服务器密钥,才会执行本步骤,将页面静态文件同步到服务器
- name: 📂 Sync files
if: env.FTP_HOST != ''
uses: SamKirkland/[email protected]
with:
local-dir: docs/.vuepress/dist/
server: ${{ secrets.ftp_host_blog }}
username: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
port: ${{ secrets.ftp_port }} # 建议更改默认的 21 端口
timeout: 600000