This repository was archived by the owner on Jun 30, 2024. It is now read-only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Wiki and Deploy to Main | |
on: | |
push: | |
branches: | |
- wiki # 触发条件,当 wiki 分支有 push 事件时触发 | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest # 运行环境 | |
steps: | |
- name: Checkout Wiki Branch | |
uses: actions/checkout@v2 | |
with: | |
ref: wiki # 检出 wiki 分支 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '10' # 选择 Node.js 版本 | |
- name: Install GitBook | |
run: npm install -g gitbook-cli # 安装 GitBook CLI | |
- name: Build GitBook | |
run: gitbook build . # 构建 GitBook 静态文件 | |
- name: Deploy to Main Branch | |
run: | | |
git clone https://github.com/BlockHaity/Hypiworld-Community-Resource-Library.git main | |
rm -rf main/source/wiki/* | |
cp -rf _book/* main/source/wiki/ # 复制静态文件 | |
cd main | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add source/wiki | |
git commit -m "Update wiki static pages" || true # 如果没有更改则不提交 | |
git push origin main |