-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (80 loc) · 2.82 KB
/
Copy pathmain.yml
File metadata and controls
93 lines (80 loc) · 2.82 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Automatic Build Docs Workflow
permissions:
contents: write
on:
push:
branches: [ test ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# 拉取主仓库
- name: Checkout main repo
uses: actions/checkout@v4
# 拉取文档主仓库
- name: Checkout DocumentsBuild
uses: actions/checkout@v4
with:
repository: The-Ti-Titanium-Adventurers-party/DocumentsBuild
token: ${{ secrets.GH_TEAM_TOKEN }}
path: DocumentsBuild
fetch-depth: 0 # 拉取完整提交历史
# 拉取1.21模组教程
- name: Checkout Tutorials
uses: actions/checkout@v4
with:
repository: The-Ti-Titanium-Adventurers-party/Minecraft1.21.1Tutorial
token: ${{ secrets.GH_TEAM_TOKEN }}
path: Tut
# 文件复制
- name: Organize files
run: |
mkdir -p DocumentsBuild/tutorial DocumentsBuild/apis DocumentsBuild/changelog
cp -r Tut/Tutorials/* DocumentsBuild/tutorial/
cp -r Tut/Apis/* DocumentsBuild/apis/
cp -r Tut/Changelog/* DocumentsBuild/changelog/
# Changelog
- name: Generate Changelog
run: |
cd DocumentsBuild
git log --pretty=format:"- *%ad* (\`%h\`) %s%n%w(0,4,4)-- %b" --date=short --no-merges | sed '/^ -- $/d' > /tmp/changelog_insert.txt
sed -i "/\[insert\]/r /tmp/changelog_insert.txt" changelog/index.md
sed -i "s/\[insert\]//g" changelog/index.md
# 打包并上传到 DocumentsBuild Release
- name: Create package
run: zip -r package.zip DocumentsBuild
- name: Upload to DocumentsBuild Release
uses: softprops/action-gh-release@v1
with:
files: package.zip
repository: The-Ti-Titanium-Adventurers-party/DocumentsBuild
tag_name: buildOutput
env:
GITHUB_TOKEN: ${{ secrets.GH_TEAM_TOKEN }}
# 构建网页
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
#cache: 'npm'
- name: Install and build
run: |
cd DocumentsBuild
npm ci
npm run clear
npm run build
# 过滤产物并复制到 docs
- name: Copy build output
run: |
git rm -rf docs || true
mkdir -p docs
cp -r DocumentsBuild/build/* docs/
rm -f docs/.nojekyll docs/404.html
- name: Commit and push docs
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs
git commit -m "Update docs from build output" || echo "No changes to commit"
git push origin HEAD:${{ github.ref_name }}