| new file mode 100755 |
| index 0000000..0e1e4f6 |
| --- /dev/null |
| +++ b/tools/sync-guide-to-website.sh |
| @@ -0,0 +1,44 @@ |
| +#!/usr/bin/env sh |
| +# Manual/local fallback for .github/workflows/sync-guide-to-website.yml — |
| +# mirrors docs/planet-scale-guide/ into elevenmessenger/website's |
| +# src/infrastructure/ (Eleventy passthrough-copies it to /infrastructure/ |
| +# unmodified — see that repo's .eleventy.js), commits, and pushes. |
| +# |
| +# The GitHub Actions workflow does this automatically on every push to main; |
| +# use this script when Actions can't run (e.g. a billing/spending-limit |
| +# block) or to test the sync before merging a guide change. Unlike the |
| +# workflow, this needs no WEBSITE_REPO_TOKEN — it uses your own local git |
| +# credentials, exactly like pushing any other change by hand. |
| +# |
| +# ./tools/sync-guide-to-website.sh <path-to-a-local-checkout-of-website> |
| +# |
| +# # first time: clone it somewhere, then point this script at it |
| +# gh repo clone elevenmessenger/website /tmp/website |
| +# ./tools/sync-guide-to-website.sh /tmp/website |
| +set -eu |
| + |
| +WEBSITE_DIR="${1:?usage: $0 <path-to-a-local-checkout-of-elevenmessenger/website>}" |
| +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| + |
| +if [ ! -d "$WEBSITE_DIR/.git" ]; then |
| + echo "sync-guide-to-website: $WEBSITE_DIR is not a git checkout — clone elevenmessenger/website there first" >&2 |
| + exit 1 |
| +fi |
| + |
| +echo "Updating $WEBSITE_DIR (git pull)..." |
| +git -C "$WEBSITE_DIR" pull --ff-only |
| + |
| +echo "Copying $REPO_ROOT/docs/planet-scale-guide/ -> $WEBSITE_DIR/src/infrastructure/..." |
| +rm -rf "$WEBSITE_DIR/src/infrastructure" |
| +mkdir -p "$WEBSITE_DIR/src/infrastructure" |
| +cp -r "$REPO_ROOT"/docs/planet-scale-guide/* "$WEBSITE_DIR/src/infrastructure/" |
| + |
| +cd "$WEBSITE_DIR" |
| +git add src/infrastructure |
| +if git diff --cached --quiet; then |
| + echo "No changes to the guide — nothing to sync." |
| + exit 0 |
| +fi |
| +git commit -m "docs: sync planet-scale guide from elevenmessenger/messenger@$(git -C "$REPO_ROOT" rev-parse --short HEAD)" |
| +git push |
| +echo "Pushed — elevenmessenger/website's own deploy workflow will publish it shortly." |