-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from naodeng/main
update gitHub action config again
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: MkDocs Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 触发构建的分支 | ||
|
||
jobs: | ||
MkDocs-Build-and-Deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x # 选择合适的 Python 版本 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
mkdocs --version | ||
# 如果你的项目依赖其他 Python 包,可以在这里安装它们 | ||
|
||
- name: Build MkDocs site | ||
run: | | ||
mkdocs build --clean | ||
mkdocs --version | ||
# 如果你的 MkDocs 配置文件不在根目录,使用 -f 选项指定文件路径,例如:mkdocs build -f path/to/mkdocs.yml | ||
|
||
- name: Upload to GitHub Pages | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: site | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
path: site | ||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
|
||
- name: Save build cache | ||
uses: actions/cache/save@v3 | ||
with: | ||
key: mkdocs-material-${{ hashfiles('.cache/**') }} | ||
path: .cache |