Delete CNAME #12
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: 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 |