52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
---
|
|
name: Build and deploy documentation
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-docs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Configure git credentials
|
|
run: |
|
|
git config --global user.name "Gitea Actions"
|
|
git config --global user.email "actions@gitea.local"
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3"
|
|
- name: Install mkdocs-material
|
|
run: pip install mkdocs-material=="9.*"
|
|
- name: Build documentation
|
|
run: mkdocs build -s
|
|
|
|
deploy-docs:
|
|
needs: build-docs
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Configure git credentials
|
|
run: |
|
|
git config --global user.name "Gitea Actions"
|
|
git config --global user.email "actions@gitea.local"
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3"
|
|
- name: Install mkdocs-material
|
|
run: pip install mkdocs-material=="9.*"
|
|
- name: Build documentation
|
|
run: mkdocs build -s
|
|
- name: Deploy documentation
|
|
run: |
|
|
git checkout --orphan gitea-pages
|
|
git rm -rf .
|
|
cp -r site/* .
|
|
git add .
|
|
git commit -m "Deploy documentation"
|
|
git push --force origin gitea-pages
|