publish-docs #27
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: publish-docs | |
on: | |
push: | |
paths: | |
- "docs/**" | |
pull_request: | |
paths: | |
- "docs/**" | |
workflow_call: | |
inputs: | |
deploy: | |
type: boolean | |
default: false | |
required: true | |
description: | |
Whether to deploy the docs or not. | |
workflow_dispatch: | |
inputs: | |
deploy: | |
type: boolean | |
default: false | |
required: true | |
description: | |
Whether to deploy the docs or not. | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout-检出项目 | |
uses: actions/checkout@v4 | |
- name: Install Poetry-安装poetry | |
shell: bash | |
run: pipx install poetry | |
- name: Setup Python-安装python环境 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: 'poetry' # 缓存poetry | |
- name: Install | |
shell: bash | |
run: | | |
poetry install --only=docs | |
poetry show | |
- name: Build-生成文档 | |
run: | | |
poetry run mkdocs build | |
- name: Deploy-部署文档 | |
if: github.event.inputs.deploy == true | |
run: | | |
poetry run mkdocs gh-deploy --force |