-
Notifications
You must be signed in to change notification settings - Fork 7.5k
80 lines (67 loc) · 2.71 KB
/
update-doc.yaml
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
80
name: Update docs on gh-pages
on:
workflow_dispatch:
inputs:
version:
description: "The version number to download and update (e.g., 4.0.3)"
required: true
jobs:
update-assets:
runs-on: ubuntu-latest
steps:
# 步骤 1:检出 gh-pages 分支的代码
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
# 步骤 2:下载指定版本的文档 ZIP 文件到 /tmp 目录
- name: Download documentation ZIP file
run: |
VERSION="${{ github.event.inputs.version }}"
DOC_DOWNLOAD_URL="https://repo1.maven.org/maven2/com/taobao/arthas/arthas-packaging/${VERSION}/arthas-packaging-${VERSION}-doc.zip"
echo "Downloading documentation from $DOC_DOWNLOAD_URL"
curl -L "$DOC_DOWNLOAD_URL" -o "/tmp/arthas-doc.zip"
# 步骤 3:解压文档 ZIP 文件
- name: Unzip documentation file
run: |
unzip -o /tmp/arthas-doc.zip -d /tmp/arthas-doc
# 步骤 4:删除仓库中的 assets 目录
- name: Remove assets directory
run: |
rm -rf assets
# 步骤 5:复制解压后的文档文件到仓库
- name: Copy documentation files to repository
run: |
cp -r /tmp/arthas-doc/* ./
# 步骤 6:下载指定版本的二进制 ZIP 文件到 /tmp 目录
- name: Download binary ZIP file
run: |
VERSION="${{ github.event.inputs.version }}"
BIN_DOWNLOAD_URL="https://repo1.maven.org/maven2/com/taobao/arthas/arthas-packaging/${VERSION}/arthas-packaging-${VERSION}-bin.zip"
echo "Downloading binary files from $BIN_DOWNLOAD_URL"
curl -L "$BIN_DOWNLOAD_URL" -o "/tmp/arthas-bin.zip"
# 步骤 7:解压二进制 ZIP 文件
- name: Unzip binary file
run: |
unzip -o /tmp/arthas-bin.zip -d /tmp/arthas-bin
# 步骤 8:复制指定文件到仓库目录
- name: Copy binary files to repository
run: |
cp /tmp/arthas-bin/as.sh ./
cp /tmp/arthas-bin/arthas-boot.jar ./
cp /tmp/arthas-bin/math-game.jar ./
# 步骤 9:赋予 as.sh 可执行权限
- name: Make as.sh executable
run: |
chmod +x as.sh
# 步骤 10:设置 Git 用户信息
- name: Set Git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
# 步骤 11:提交并推送更改到远程仓库
- name: Commit and push changes
run: |
git add .
git commit -m "Update docs to version ${{ github.event.inputs.version }}"
git push origin gh-pages