scripts/publish-docs.sh

04c003a331155cbb2f0ffe00d9b71da6a11277a4
orgstar/scripts/publish-docs.sh

27 lines · 895 bytes · executable

 1#!/bin/sh
 2# Builds the user manual in docs/manual with orgo and force-pushes it to the `pages`
 3# branch, which gitbay serves at https://krz.gitbay.site/orgstar/.
 4# Usage: scripts/publish-docs.sh [--dry-run]
 5set -eu
 6
 7cd "$(dirname "$0")/.."
 8tmp=$(mktemp -d)
 9trap 'rm -rf "$tmp"' EXIT
10site="$tmp/site"
11
12orgo build docs/manual -o "$site" --strict --no-cache
13rm -f "$site/.orgo-cache.json"
14
15if [ "${1:-}" = "--dry-run" ]; then
16	echo "built $(find "$site" -name '*.html' | wc -l | tr -d ' ') pages; not published"
17	exit 0
18fi
19
20# The pages branch holds only the built site, replaced on each publish.
21sha=$(git rev-parse --short HEAD)
22git init -q "$tmp/work"
23cp -R "$site/." "$tmp/work/"
24git -C "$tmp/work" add -A
25git -C "$tmp/work" commit -q -m "Publish the manual from $sha"
26git -C "$tmp/work" push -q --force "$(git remote get-url origin)" HEAD:refs/heads/pages
27echo "published the manual from $sha"
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form