-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (72 loc) · 2.33 KB
/
deploy_github_pages.yml
File metadata and controls
84 lines (72 loc) · 2.33 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
name: deploy_github_pages
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_commit_and_publish:
if: ${{ !contains(github.event.head_commit.message, '[no deploy]') }}
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: 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 github_docs
uses: actions/checkout@v4.1.1
with:
ssh-key: ${{ secrets.RSA_PRIVATE_KEY }}
ref: github_docs
path: github_docs
- name: Replace question-board.readthedocs.io/ to feignclaims.github.io/question_board/
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'main/conf.py'
find: '"https://question-board.readthedocs.io/"'
replace: '"https://feignclaims.github.io/question_board/"'
regex: false
- name: Show mirror website
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'main/index.rst'
find: '`本网站的国外备用网址 (不支持搜索) <https://feignclaims.github.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 github_docs
shell: bash
run: |
rm -rf github_docs/build
sphinx-build -b dirhtml main github_docs/build
- name: Commit changes
uses: EndBug/add-and-commit@v9.1.3
with:
cwd: github_docs
commit: '--amend'
push: '--force'
default_author: github_actions
message: '[bot] Build github pages'
- name: Setup Github Pages
uses: actions/configure-pages@v5
- name: Upload Github Artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'github_docs/build'
- name: Build Github Pages
uses: actions/deploy-pages@v4