#!/usr/bin/env bash set -euo pipefail # Script to sync local docs/ to the Gitea wiki for this repo. # Requires SSH access to the wiki (deploy key or account key). WIKI_REPO="git@gitea.appstack.me:nick/simian.wiki.git" TMPDIR="$(mktemp -d)" echo "Cloning wiki to $TMPDIR" git clone "$WIKI_REPO" "$TMPDIR" echo "Syncing docs/ -> wiki/" rsync -av --delete docs/ "$TMPDIR"/ pushd "$TMPDIR" > /dev/null git add -A if git diff --staged --quiet; then echo "No changes to wiki" else git commit -m "Update wiki from docs" git push origin HEAD fi popd > /dev/null rm -rf "$TMPDIR" echo "Done."