-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (57 loc) · 2.07 KB
/
doc-build.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
63
64
65
66
67
68
69
name: PNX-doc
on: [ push, workflow_dispatch ]
jobs:
check-files:
name: 检查仓库文件
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }}
steps:
- name: 检出仓库内容
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 检查文件改动情况
id: check-changed-files
uses: tj-actions/[email protected]
with:
since_last_remote_commit: 'true'
- name: 输出更改文件列表
run: echo ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }}
build:
name: 渲染markdown文件
runs-on: ubuntu-latest
needs: check-files
if: contains(needs.check-files.outputs.changed-files, 'doc/') || contains(needs.check-files.outputs.changed-files, 'build/') || (github.event_name == 'push' && contains(github.event.commits[0].message, '+b')) || (github.event_name == 'workflow_dispatch')
steps:
- uses: actions/checkout@v1
name: 检出仓库内容
with:
fetch-depth: 0
- uses: actions/setup-java@v2
name: 配置java环境
with:
distribution: 'temurin'
java-version: '17'
- name: 构建中文文档
run: cd build && bash build.sh
- name: 上传文档
uses: actions/upload-artifact@v3
if: success()
with:
name: PNX_Documents
path: target/output
- name: 部署文档到OSS
uses: fangbinwei/aliyun-oss-website-action@v1
if: (github.ref_name == 'master') && success()
with:
accessKeyId: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
accessKeySecret: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
bucket: pnx-doc
endpoint: oss-cn-hongkong.aliyuncs.com
folder: target/output
skipSetting: true
- name: 部署到PNX云
run: bash .github/scripts/deploy-doc.sh ${{ secrets.PNX_CLOUD_TOKEN }}
- name: 输出上传内容
run: echo ${{ steps.upload-oss.outputs.url }}