Files
alexm 717c4b412a
CI / check (push) Successful in 8m52s
Deploy docs / deploy (push) Failing after 1m50s
Nightly / nightly (push) Successful in 10m54s
ci: separate docs into scripts
2026-08-07 16:54:59 -04:00

33 lines
954 B
Bash
Executable File

#!/usr/bin/env bash
# Publish a built docs channel to the web root.
# Usage: publish-docs.sh <release|nightly> [-d docroot] [-w www_root] [-s site_slug]
# Env: DOCROOT (default target/doc), WWW_ROOT (default /srv/www),
# SITE_SLUG (default coursebank).
# Flags, if given, override the corresponding env var / default.
set -euo pipefail
usage() {
echo "Usage: $0 <release|nightly> [-d docroot] [-w www_root] [-s site_slug]" >&2
exit 1
}
channel="${1:?usage: publish-docs.sh <release|nightly> [-d docroot] [-w www_root] [-s site_slug]}"
shift
docroot="${DOCROOT:-target/doc}"
www_root="${WWW_ROOT:-/srv/www}"
site_slug="${SITE_SLUG:-coursebank}"
while getopts "d:w:s:" opt; do
case "$opt" in
d) docroot="$OPTARG" ;;
w) www_root="$OPTARG" ;;
s) site_slug="$OPTARG" ;;
*) usage ;;
esac
done
dest="${www_root}/${site_slug}/${channel}"
mkdir -p "$dest"
rsync -a --delete "$docroot/" "$dest/"
echo "published $docroot -> $dest"