第八章 21 精校 #269
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
# 自动构建(避免编译异常,仅在 staging 分支构建,需手动合并) | |
name: Automatically Build GitBook | |
on: | |
# 手动触发构建 | |
workflow_dispatch: | |
# 合并触发 | |
# pull_request: | |
# branches: | |
# - master | |
# 提交触发 | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# 当仓库隶属组织时,赋予流水线“写权限”以便提交变更 | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
fetch-depth: 0 | |
- name: Setup Git Infomation | |
run: |- | |
git config --global user.name "${{ vars._GIT_USER }}" | |
git config --global user.email "${{ vars._GIT_MAIL }}" | |
- name: Setup Deploy Private Key | |
env: | |
DEPLOY_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa | |
chmod 400 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Compile | |
run: |- | |
./bin/build.sh | |
- name: Commit and push Github page (if changed) | |
run: |- | |
git add -A | |
git commit -m "Updated by Github Bot" || exit 0 | |
git push origin master | |