ci: publish MkDocs with Gitea Actions
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
name: Publish documentation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "docs/**"
|
||||||
|
- "mkdocs.yml"
|
||||||
|
- "docs/requirements.txt"
|
||||||
|
- ".gitea/workflows/publish-docs.yml"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: documentation
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
REPOSITORY_URL: ${{ gitea.server_url }}/${{ gitea.repository }}.git
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout documentation source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
cache: pip
|
||||||
|
cache-dependency-path: docs/requirements.txt
|
||||||
|
|
||||||
|
- name: Install MkDocs dependencies
|
||||||
|
run: python -m pip install -r docs/requirements.txt
|
||||||
|
|
||||||
|
- name: Build documentation
|
||||||
|
# Some documented source files intentionally live outside docs/.
|
||||||
|
run: mkdocs build
|
||||||
|
|
||||||
|
- name: Publish generated site to the pages branch
|
||||||
|
working-directory: site
|
||||||
|
run: |
|
||||||
|
git init
|
||||||
|
git config user.name "Gitea Actions"
|
||||||
|
git config user.email "actions@${{ gitea.server_url }}"
|
||||||
|
git add --all
|
||||||
|
git commit --message "Publish documentation for ${{ gitea.sha }}"
|
||||||
|
git -c http.extraheader="Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
push --force "${REPOSITORY_URL}" HEAD:pages
|
||||||
Reference in New Issue
Block a user