83 lines
2.9 KiB
YAML
83 lines
2.9 KiB
YAML
# Docs website of this fork: https://tth-pub.pages.rfa.cz/meshcore-tth/
|
|
#
|
|
# Runs only in the published repo (tth-pub/meshcore-tth), after a push to main
|
|
# that touches the docs: .github/docs-site.sh builds the site (mkdocs, theme
|
|
# mkdocs-terminal, mkdocs.tth.yml) from the public tree -- the export leaves
|
|
# our operations docs out, so nothing private can end up on it -- and the
|
|
# result is force-pushed as the only commit of the branch `pages`. A webhook
|
|
# of the repo (push, branch filter `pages`) tells git-pages on pages.rfa.cz,
|
|
# which clones the branch anonymously: no token outside this repo's own.
|
|
# git-pages: roles/git_pages in the proxmox.rfa.cz repo.
|
|
name: tth-docs
|
|
|
|
"on":
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "docs/**"
|
|
- "README.md"
|
|
- "mkdocs.tth.yml"
|
|
- ".github/docs-site.sh"
|
|
- ".github/workflows/tth-docs.yml"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: tth-docs
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
MKDOCS_VERSION: "1.6.1"
|
|
MKDOCS_TERMINAL_VERSION: "4.8.0"
|
|
MARKDOWN_CALLOUTS_VERSION: "0.4.0"
|
|
PYMDOWN_EXTENSIONS_VERSION: "13.1.2"
|
|
|
|
jobs:
|
|
site:
|
|
if: github.repository == 'tth-pub/meshcore-tth'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# No actions/setup-python: its builds need x86-64-v3, the runner has v2
|
|
# (see tth-tools-lint.yml). mkdocs goes into a venv of the image's python3.
|
|
- name: Install mkdocs
|
|
run: |
|
|
set -euo pipefail
|
|
SUDO="$(command -v sudo || true)"
|
|
if ! python3 -m venv "$RUNNER_TEMP/docs"; then
|
|
$SUDO apt-get update -qq
|
|
$SUDO apt-get install -y -qq python3 python3-venv
|
|
python3 -m venv --clear "$RUNNER_TEMP/docs"
|
|
fi
|
|
"$RUNNER_TEMP/docs/bin/pip" install --quiet \
|
|
"mkdocs==$MKDOCS_VERSION" "mkdocs-terminal==$MKDOCS_TERMINAL_VERSION" \
|
|
"markdown-callouts==$MARKDOWN_CALLOUTS_VERSION" \
|
|
"pymdown-extensions==$PYMDOWN_EXTENSIONS_VERSION"
|
|
echo "$RUNNER_TEMP/docs/bin" >>"$GITHUB_PATH"
|
|
|
|
- name: Build
|
|
env:
|
|
NO_MKDOCS_2_WARNING: "1"
|
|
run: bash .github/docs-site.sh "$RUNNER_TEMP/site"
|
|
|
|
# A worktree shares the checkout's credentials (github.token); the
|
|
# branch keeps one commit, the site of the newest main.
|
|
- name: Publish to the pages branch
|
|
run: |
|
|
set -euo pipefail
|
|
git config --global user.name "tth-docs"
|
|
git config --global user.email "tth-docs@localhost"
|
|
wt="$RUNNER_TEMP/pages"
|
|
git worktree add -q --detach "$wt"
|
|
cd "$wt"
|
|
git checkout -q --orphan pages-build
|
|
git rm -rqf .
|
|
cp -r "$RUNNER_TEMP/site/." .
|
|
git add -A
|
|
git commit -q -m "docs site from main ${GITHUB_SHA:0:8}"
|
|
git push -q -f origin HEAD:refs/heads/pages
|
|
echo "published ${GITHUB_SHA:0:8} to pages"
|