Files
portal/.gitea/workflows/docs.yml
T
2026-09-30 13:31:23 +02:00

46 lines
1.5 KiB
YAML

name: docs
# docs/ as a site at portal.uhhm.no: built with mdBook and put to
# git-pages on every push to main that touches it (the uhhm pages
# pattern, uhhm/infrastructure PAGES.md). The changelog rides along as
# the book's last page. Authorized by the _git-pages-forge-allowlist
# TXT record for portal.uhhm.no plus a token the forge confirms may
# push to this repo (the GITEA_TOKEN secret).
on:
push:
branches: [main]
paths: ["docs/**", "book.toml", "CHANGELOG.md", ".gitea/workflows/docs.yml"]
workflow_dispatch:
env:
MDBOOK_VERSION: v0.5.4
jobs:
deploy:
runs-on: bare
steps:
- uses: actions/checkout@v4
- name: build the book
run: |
set -eu
tool=/var/local/cargo-target/mdbook-$MDBOOK_VERSION
if [ ! -x "$tool/mdbook" ]; then
mkdir -p "$tool"
curl -sSfL "https://github.com/rust-lang/mdBook/releases/download/$MDBOOK_VERSION/mdbook-$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz" | tar -xz -C "$tool"
fi
cp CHANGELOG.md docs/changelog.md
"$tool/mdbook" build
test -f target/book/index.html
test -f target/book/memberships.html
- name: deploy to portal.uhhm.no
run: |
tar -czf site.tar.gz -C target/book .
curl --fail -sS -X PUT "https://portal.uhhm.no/" \
-H "Content-Type: application/x-tar+gzip" \
-H "Forge-Authorization: token ${{ secrets.GITEA_TOKEN }}" \
--data-binary @site.tar.gz \
-w "deployed: %{http_code}\n"