ci: separate docs into scripts
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user