加载完成后自动刷新以应对缓存和跳转问题 #30
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 | |
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/setup-python@v5.0.0 | |
with: | |
python-version: "3.11" | |
- name: Checkout sources | |
uses: actions/checkout@v4.1.1 | |
with: | |
path: main | |
fetch-depth: 0 | |
- name: Checkout docs | |
uses: actions/checkout@v4.1.1 | |
with: | |
ref: docs | |
path: docs | |
- name: Install sphinx | |
shell: bash | |
run: | | |
pip install -r main/docs/requirements.txt | |
- name: Build docs | |
shell: bash | |
run: | | |
rm -rf docs/build | |
sphinx-build main/docs docs/build | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9.1.3 | |
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/git-mirror-action@v1.2.0 | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | |
with: | |
source-repo: git@github.com:FeignClaims/vscode_cpp_starter.git | |
destination-repo: git@gitee.com:cpp_tutorial/vscode_cpp_starter.git | |
publish: | |
runs-on: ubuntu-latest | |
needs: sync | |
steps: | |
- name: Build Gitee Pages | |
uses: yanglbme/gitee-pages-action@v1.4.2 | |
with: | |
gitee-username: FeignClaims | |
gitee-password: ${{ secrets.GITEE_PASSWORD }} | |
gitee-repo: cpp_tutorial/vscode_cpp_starter | |
branch: docs | |
directory: build |