From a97fb275db9143057c9e20033c35bc6caa24775e Mon Sep 17 00:00:00 2001 From: Joshua Date: Tue, 17 Feb 2026 14:40:45 -0800 Subject: [PATCH] Add PAT-based split-repo publish script --- README.md | 4 ++ docs/repo-split-publish-runbook.md | 7 ++++ scripts/publish_split_repos.sh | 62 ++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100755 scripts/publish_split_repos.sh diff --git a/README.md b/README.md index 8a7c82b..1cdb96d 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,10 @@ docs/ README.md ``` +## Scripts + +1. `scripts/publish_split_repos.sh` - creates/pushes `launcher`, `governance`, `contracts` repos using a Gitea PAT. + ## Internationalization Landing-page i18n rules: diff --git a/docs/repo-split-publish-runbook.md b/docs/repo-split-publish-runbook.md index 05c4c1b..3d35e5c 100644 --- a/docs/repo-split-publish-runbook.md +++ b/docs/repo-split-publish-runbook.md @@ -24,6 +24,13 @@ curl -fsSL -H "Authorization: token " -H "Content-Type: application/json" Repeat for `governance` and `contracts`. +Or run the helper: + +```bash +cd "/Users/vsg/Documents/VSG Codex/web" +./scripts/publish_split_repos.sh +``` + ## Push Local Seed Repos ```bash diff --git a/scripts/publish_split_repos.sh b/scripts/publish_split_repos.sh new file mode 100755 index 0000000..3d9f2b3 --- /dev/null +++ b/scripts/publish_split_repos.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ $# -lt 1 ]]; then + echo "Usage: $0 [org] [host]" >&2 + exit 1 +fi + +TOKEN="$1" +ORG="${2:-edut}" +HOST="${3:-git.workvsg.com}" +ROOT="/Users/vsg/Documents/VSG Codex" + +create_repo() { + local name="$1" + local private="$2" + local desc="$3" + + local api="https://${HOST}/api/v1/repos/${ORG}/${name}" + local status + status=$(curl -sS -o /tmp/repo_check_${name}.json -w "%{http_code}" \ + -H "Authorization: token ${TOKEN}" \ + "$api") + + if [[ "$status" == "200" ]]; then + echo "Repo ${ORG}/${name} already exists" + return + fi + + curl -fsSL \ + -H "Authorization: token ${TOKEN}" \ + -H 'Content-Type: application/json' \ + -X POST "https://${HOST}/api/v1/orgs/${ORG}/repos" \ + -d "{\"name\":\"${name}\",\"private\":${private},\"description\":\"${desc}\"}" >/tmp/repo_create_${name}.json + + echo "Created repo ${ORG}/${name}" +} + +wire_and_push() { + local local_dir="$1" + local name="$2" + local remote_url="https://${HOST}/${ORG}/${name}.git" + + cd "$local_dir" + if ! git remote | grep -q '^origin$'; then + git remote add origin "$remote_url" + else + git remote set-url origin "$remote_url" + fi + git push -u origin main + echo "Pushed ${local_dir} -> ${remote_url}" +} + +create_repo "launcher" "true" "EDUT free launcher shell and wallet onboarding app" +create_repo "governance" "true" "EDUT deterministic governance runtime" +create_repo "contracts" "false" "EDUT membership and entitlement contracts" + +wire_and_push "${ROOT}/launcher" "launcher" +wire_and_push "${ROOT}/governance" "governance" +wire_and_push "${ROOT}/contracts" "contracts" + +echo "Split repo publish complete"