-
Notifications
You must be signed in to change notification settings - Fork 30
79 lines (66 loc) · 2.31 KB
/
deploy_document.yml
File metadata and controls
79 lines (66 loc) · 2.31 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 工作流的名称
name: Deploy document
# 工作流的触发事件
on:
push
# 工作流中的所有工作
jobs:
# 这里只有一个工作,我们将其命名为 main(取别的名字也行)
main:
# 仅允许在原始仓库 Explorer-Dong/wiki 中运行
if: ${{ github.repository == 'Explorer-Dong/wiki' }}
# 当前工作的运行环境
runs-on: ubuntu-latest
# 具体的工作步骤
steps:
# 将当前仓库 clone 到 GitHub Actions 环境
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # fetch all commit history
# 配置 Python 环境
- name: Setup python
uses: actions/setup-python@v6
with:
python-version: '3.13.11'
# 配置 uv 包管理工具
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: "true"
# 安装 Python 包依赖
- name: Install python dependence
run: uv sync
# 构建网页
- name: Build website
run: zensical build
# 安装 Aliyun CLI
- name: Setup Aliyun CLI
uses: aliyun/setup-aliyun-cli-action@v1
# 配置 Aliyun CLI
- name: Config Aliyun CLI
run: |
aliyun configure set \
--mode AK \
--region ${{ vars.REGION }} \
--access-key-id ${{ secrets.ALIYUN_ACCESS_KEY_ID }} \
--access-key-secret ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
# 把网页部署到 Aliyun OSS (Private)
- name: Deploy to Aliyun OSS
run: |
aliyun ossutil rm ${{ vars.WEB_OSS_PATH }} -r -f
aliyun ossutil cp oss://public-assets-shanghai/files/BingSiteAuth.xml ${{ vars.WEB_OSS_PATH }} -f
aliyun ossutil cp ./site/ ${{ vars.WEB_OSS_PATH }} -r -f -j 20
# -r 表示递归操作
# -f 表示强制操作
# -j 表示使用的线程数(启用 -f 才有效)
# 刷新 Aliyun ESA (Public)
- name: Refresh Aliyun ESA
run: |
aliyun esa PurgeCaches \
--region cn-hangzhou \
--Content '{"CacheKeys":[],"Hostnames":[],"Directories":["${{ vars.WEB_DIRECTORY }}"]}' \
--SiteId 1185133088541216 \
--Type directory \
--Force false \
--EdgeComputePurge true