安装 homebrew 自动更新的前置软件 #75
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: deploy_to_gitee | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_and_commit: | |
if: ${{ !contains(github.event.head_commit.message, '[no deploy]') }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.11" | |
- name: Checkout sources | |
uses: actions/[email protected] | |
with: | |
path: main | |
fetch-depth: 0 | |
- name: Checkout docs | |
uses: actions/[email protected] | |
with: | |
ssh-key: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | |
ref: docs | |
path: docs | |
- name: Replace question-board.readthedocs.io/ to cpp_tutorial.gitee.io/board/ | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
include: "main/conf.py" | |
find: '"https://question-board.readthedocs.io/"' | |
replace: '"https://cpp_tutorial.gitee.io/board/"' | |
regex: false | |
- name: Show mirror website | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
include: "main/index.rst" | |
find: "`本网站的国内网址 (不支持搜索) <https://cpp_tutorial.gitee.io/vscode_cpp_starter/>`_" | |
replace: "`本网站的国外网址 (支持搜索) <https://vscode-cpp-starter.readthedocs.io/>`_" | |
regex: false | |
- name: Install sphinx | |
shell: bash | |
run: | | |
pip install -r main/requirements.txt | |
- name: Build docs | |
shell: bash | |
run: | | |
rm -rf docs/build | |
sphinx-build main docs/build | |
- name: Commit changes | |
uses: EndBug/[email protected] | |
with: | |
cwd: docs | |
commit: "--amend" | |
push: "--force" | |
default_author: github_actions | |
message: "[bot] Build gitee pages" | |
sync: | |
runs-on: ubuntu-latest | |
needs: build_and_commit | |
steps: | |
- name: Sync to gitee.com | |
uses: wearerequired/[email protected] | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | |
with: | |
source-repo: [email protected]:FeignClaims/vscode_cpp_starter.git | |
destination-repo: [email protected]:cpp_tutorial/vscode_cpp_starter.git | |
publish: | |
runs-on: ubuntu-latest | |
needs: sync | |
steps: | |
- name: Build Gitee Pages | |
uses: yanglbme/[email protected] | |
with: | |
gitee-username: FeignClaims | |
gitee-password: ${{ secrets.GITEE_PASSWORD }} | |
gitee-repo: cpp_tutorial/vscode_cpp_starter | |
branch: docs | |
directory: build |