ci: split docs generation and publishing across gitea/github
This commit is contained in:
@@ -0,0 +1,63 @@
|
|||||||
|
name: Generate Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 */6 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate:
|
||||||
|
runs-on: docker-server
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Generate docs
|
||||||
|
run: |
|
||||||
|
scripts/docs/generate-all.sh
|
||||||
|
|
||||||
|
- name: Validate generated docs
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
test -s docs/generated/docker-compose.resolved.yml
|
||||||
|
test -s docs/generated/host-topology.md
|
||||||
|
test -s docs/public/physical-topology.svg
|
||||||
|
test -s docs/public/docker-traefik-dynu.svg
|
||||||
|
|
||||||
|
! grep -R "Host inventory JSON not found" docs/public docs/diagrams
|
||||||
|
! grep -R "Generate terraform inventory" docs/public docs/diagrams
|
||||||
|
|
||||||
|
# Ensure no obvious secrets leaked
|
||||||
|
! grep -R -i "password\|token\|api[_-]?key\|secret" docs/public || (echo "Secret-like string detected"; exit 1)
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
git config user.name "docs-bot"
|
||||||
|
git config user.email "docs-bot@local"
|
||||||
|
|
||||||
|
git add docs/generated docs/diagrams docs/public data/terraform/proxmox-inventory.json || true
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "docs: regenerate documentation artifacts"
|
||||||
|
|
||||||
|
- name: Push to Gitea
|
||||||
|
run: |
|
||||||
|
git push origin HEAD:main
|
||||||
|
|
||||||
|
- name: Push to GitHub mirror
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
|
||||||
|
GITHUB_MIRROR_REPO: ${{ vars.GITHUB_MIRROR_REPO }}
|
||||||
|
run: |
|
||||||
|
test -n "$GITHUB_TOKEN"
|
||||||
|
test -n "$GITHUB_MIRROR_REPO"
|
||||||
|
git remote add github "https://$GITHUB_TOKEN@github.com/$GITHUB_MIRROR_REPO.git" || true
|
||||||
|
git push github HEAD:main
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
name: Validate Docs (Gitea)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: docker-server
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Validate docs
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
test -d docs/public
|
||||||
|
test -s docs/public/physical-topology.svg
|
||||||
|
|
||||||
|
! grep -R "Host inventory JSON not found" docs/public
|
||||||
|
! grep -R "Generate terraform inventory" docs/public
|
||||||
@@ -3,18 +3,8 @@ name: Validate committed public docs
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
|
||||||
- "docs/generated/**"
|
|
||||||
- "docs/diagrams/**"
|
|
||||||
- "docs/public/**"
|
|
||||||
- "site/**"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
|
||||||
- "docs/generated/**"
|
|
||||||
- "docs/diagrams/**"
|
|
||||||
- "docs/public/**"
|
|
||||||
- "site/**"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -29,17 +19,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
test -d docs/public
|
test -d docs/public
|
||||||
test -n "$(find docs/public -mindepth 1 -print -quit)"
|
test -n "$(find docs/public -mindepth 1 -print -quit)"
|
||||||
- name: Install Graphviz and MkDocs
|
- name: Install MkDocs
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y graphviz
|
|
||||||
dot -V
|
|
||||||
python3 -m pip install --user mkdocs
|
python3 -m pip install --user mkdocs
|
||||||
- name: Validate public docs and diagrams
|
- name: Validate docs content
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
test -s docs/public/physical-topology.svg
|
||||||
|
test -s docs/public/docker-traefik-dynu.svg
|
||||||
|
! grep -R "Host inventory JSON not found" docs/public
|
||||||
|
! grep -R "Generate terraform inventory" docs/public
|
||||||
|
! rg -n -i "password|token|api[_-]?key|secret" docs/public
|
||||||
|
- name: Build MkDocs site
|
||||||
run: |
|
run: |
|
||||||
test -f docs/public/physical-topology.svg
|
|
||||||
test -f docs/public/docker-traefik-dynu.svg
|
|
||||||
! rg -n "Graphviz dot not found" docs/public/*.svg
|
|
||||||
! rg -n "lan\.ddnsgeek\.com" docs/public/*.svg docs/public/*.md
|
|
||||||
! rg -n -i "password|token|api_key|secret" docs/public/*.svg
|
|
||||||
python3 -m mkdocs build -f mkdocs-public.yml --strict
|
python3 -m mkdocs build -f mkdocs-public.yml --strict
|
||||||
|
|||||||
@@ -43,3 +43,11 @@ site/
|
|||||||
!docs/public/
|
!docs/public/
|
||||||
!docs/public/*.md
|
!docs/public/*.md
|
||||||
!docs/public/*.svg
|
!docs/public/*.svg
|
||||||
|
|
||||||
|
# Terraform local/state artifacts
|
||||||
|
**/.terraform/
|
||||||
|
**/.terraform.lock.hcl
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.*
|
||||||
|
*.tfvars
|
||||||
|
*.tfvars.json
|
||||||
|
|||||||
Reference in New Issue
Block a user