-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (55 loc) · 1.85 KB
/
documentation.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
60
61
62
name: Documentation
on:
push:
branches:
- main # update to match your development branch (master, main, dev, trunk, ...)
tags: '*'
paths:
- 'docs/**' # 只有docs目录下的文件改变时触发
- 'src/**' # 源代码改变时触发
- '*.toml' # 项目配置文件改变时触发
- '.github/workflows/documentation.yml' # 工作流配置改变时触发
pull_request:
paths:
- 'docs/**'
- 'src/**'
- '*.toml'
- '.github/workflows/documentation.yml'
jobs:
build:
permissions:
actions: write
contents: write
pull-requests: read
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 缓存整个 Julia 环境
- uses: julia-actions/setup-julia@v2
with:
version: '1'
# 优化缓存配置
- uses: julia-actions/cache@v2
with:
cache-registries: "true" # 缓存包注册表
cache-packages: "true" # 缓存已安装的包
cache-artifacts: "true" # 缓存构建产物
# 缓存文档构建依赖
- uses: actions/cache@v3
with:
path: |
docs/build
docs/src/__site
key: ${{ runner.os }}-docs-${{ hashFiles('docs/Project.toml', 'docs/make.jl') }}
restore-keys: |
${{ runner.os }}-docs-
# 只在缓存未命中时安装依赖
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
run: julia --project=docs/ docs/make.jl