Skip to content

#2 Add Website Instructions 2 #230

#2 Add Website Instructions 2

#2 Add Website Instructions 2 #230

Workflow file for this run

name: publish site
on: # 在什么时候触发工作流
push: # 在从本地main分支被push到GitHub仓库时
branches:
- main
pull_request: # 在main分支合并别人提的pr时
branches:
- main
env:
TZ: Asia/Shanghai
jobs: # 工作流的具体内容
deploy:
runs-on: ubuntu-latest # 创建一个新的云端虚拟机 使用最新Ubuntu系统
steps:
# - name: Checkout master
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Set up Python3.x
uses: actions/setup-python@v5
with:
python-version: "3.10"
# 待完成:放在requirement.txt 文件夹里!
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-authors-plugin jieba mkdocs-statistics-plugin mkdocs-mermaid2-plugin mkdocs-blogging-plugin
# run: |
# python -m pip install --upgrade pip
# pip install setuptools==71.1.0
# pip install --no-build-isolation
# - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-authors-plugin jieba mkdocs-statistics-plugin mkdocs-mermaid2-plugin mkdocs-blogging-plugin --no-build-isolation # 使用pip包管理工具安装mkdocs-materials
- run: mkdocs gh-deploy --force # 使用mkdocs-material部署gh-pages分支