Add PAT-based split-repo publish script
This commit is contained in:
parent
b022a0f7e4
commit
a97fb275db
@ -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:
|
||||
|
||||
@ -24,6 +24,13 @@ curl -fsSL -H "Authorization: token <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 <gitea_pat>
|
||||
```
|
||||
|
||||
## Push Local Seed Repos
|
||||
|
||||
```bash
|
||||
|
||||
62
scripts/publish_split_repos.sh
Executable file
62
scripts/publish_split_repos.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Usage: $0 <gitea_pat> [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"
|
||||
Loading…
Reference in New Issue
Block a user