44# Fork community repos into supermodeltools org, set up arch-docs workflow,
55# enable GitHub Pages, and trigger the first build.
66#
7+ # Community repos deploy arch-docs to GitHub Pages at supermodeltools.github.io/{repo}/
8+ # The central site proxies those paths via Cloudflare Pages _redirects.
9+ #
710# Prerequisites:
811# - gh CLI authenticated with supermodeltools org admin access
9- # - SUPERMODEL_API_KEY environment variable set
12+ # - SUPERMODEL_API_KEY is available as an org-level secret (no local env needed)
1013#
1114# Usage:
12- # SUPERMODEL_API_KEY=sk-... ./setup-community-repos.sh
15+ # ./setup-community-repos.sh
1316
1417set -euo pipefail
1518
16- if [ -z " ${SUPERMODEL_API_KEY:- } " ]; then
17- echo " Error: SUPERMODEL_API_KEY environment variable is required"
18- exit 1
19- fi
20-
2119ORG=" supermodeltools"
2220
21+ # Community repos from repos.yaml (upstream → fork name)
2322REPOS=(
24- " facebook/react"
25- " vercel/next.js"
2623 " vuejs/vue"
27- " sveltejs/svelte"
28- " expressjs/express"
29- " fastify/fastify"
30- " pallets/flask"
31- " django/django"
32- " golang/go"
33- " rust-lang/rust"
34- " denoland/deno"
3524 " oven-sh/bun"
36- " langchain-ai/langchain"
37- " huggingface/transformers"
38- " anthropics/anthropic-sdk-python"
25+ " tiangolo/fastapi"
26+ " gin-gonic/gin"
27+ " spring-projects/spring-boot"
28+ " pytorch/pytorch"
3929 " supabase/supabase"
40- " drizzle-team/drizzle-orm"
4130 " tailwindlabs/tailwindcss"
42- " shadcn-ui/ui"
43- " astro-build/astro"
4431)
4532
33+ # GitHub Pages deployment workflow (no BOT_TOKEN needed)
4634WORKFLOW_CONTENT=' name: Architecture Docs
4735
4836on:
5240
5341permissions:
5442 contents: read
43+ pages: write
44+ id-token: write
45+
46+ concurrency:
47+ group: pages
48+ cancel-in-progress: true
5549
5650jobs:
5751 build-and-deploy:
5852 runs-on: ubuntu-latest
53+ environment:
54+ name: github-pages
55+ url: ${{ steps.deploy.outputs.page_url }}
5956 steps:
6057 - uses: actions/checkout@v4
6158
@@ -65,27 +62,14 @@ jobs:
6562 supermodel-api-key: ${{ secrets.SUPERMODEL_API_KEY }}
6663 base-url: https://repos.supermodeltools.com
6764
68- - name: Deploy to central site
69- env:
70- BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
71- REPO_NAME: ${{ github.event.repository.name }}
72- run: |
73- git config --global user.name "supermodel-bot"
74- git config --global user.email "bot@supermodeltools.com"
75- git clone https://x-access-token:${BOT_TOKEN}@github.com/GraphTechnologyDevelopers/graphtechnologydevelopers.github.io.git central-site
76- rm -rf central-site/site/${REPO_NAME}
77- mkdir -p central-site/site/${REPO_NAME}
78- cp -r arch-docs-output/. central-site/site/${REPO_NAME}/
79- cd central-site
80- git add site/${REPO_NAME}/
81- git diff --staged --quiet && echo "No changes" && exit 0
82- git commit -m "Deploy arch-docs for ${REPO_NAME}"
83- for i in 1 2 3 4 5; do
84- git push && break
85- echo "Push failed, retrying in ${i}0s..."
86- sleep $((i * 10))
87- git pull --rebase origin main
88- done'
65+ - uses: actions/configure-pages@v5
66+
67+ - uses: actions/upload-pages-artifact@v3
68+ with:
69+ path: ./arch-docs-output
70+
71+ - uses: actions/deploy-pages@v4
72+ id: deploy'
8973
9074for UPSTREAM in " ${REPOS[@]} " ; do
9175 REPO_NAME=" ${UPSTREAM##*/ } "
@@ -99,20 +83,16 @@ for UPSTREAM in "${REPOS[@]}"; do
9983 else
10084 echo " Forking ${UPSTREAM} into ${ORG} ..."
10185 gh repo fork " ${UPSTREAM} " --org " ${ORG} " --clone=false
102- sleep 2
86+ sleep 3
10387 fi
10488
105- # 2. Set the SUPERMODEL_API_KEY secret
106- echo " Setting SUPERMODEL_API_KEY secret..."
107- gh secret set SUPERMODEL_API_KEY --repo " ${FORK} " --body " ${SUPERMODEL_API_KEY} "
108-
109- # 3. Detect default branch
89+ # 2. Detect default branch
11090 DEFAULT_BRANCH=$( gh api " repos/${FORK} " --jq ' .default_branch' )
11191 echo " Default branch: ${DEFAULT_BRANCH} "
11292
113- # 4 . Push the arch-docs workflow file
93+ # 3 . Push the arch-docs workflow file
11494 echo " Creating arch-docs workflow..."
115- ENCODED=$( echo -n " ${WORKFLOW_CONTENT} " | base64)
95+ ENCODED=$( printf ' %s ' " ${WORKFLOW_CONTENT} " | base64 | tr -d ' \n ' )
11696
11797 # Check if workflow already exists
11898 EXISTING_SHA=$( gh api " repos/${FORK} /contents/.github/workflows/arch-docs.yml" --jq ' .sha' 2> /dev/null || echo " " )
@@ -132,7 +112,7 @@ for UPSTREAM in "${REPOS[@]}"; do
132112 --silent
133113 fi
134114
135- # 5 . Enable GitHub Pages with Actions as source
115+ # 4 . Enable GitHub Pages with Actions as source
136116 echo " Enabling GitHub Pages..."
137117 gh api --method POST " repos/${FORK} /pages" \
138118 -f build_type=" workflow" \
@@ -142,14 +122,16 @@ for UPSTREAM in "${REPOS[@]}"; do
142122 --silent 2> /dev/null || \
143123 echo " (Pages may already be configured)"
144124
145- # 6 . Trigger the workflow
125+ # 5 . Trigger the workflow
146126 echo " Triggering arch-docs workflow..."
127+ sleep 2 # brief pause for workflow file to propagate
147128 gh workflow run arch-docs.yml --repo " ${FORK} " --ref " ${DEFAULT_BRANCH} " 2> /dev/null || \
148- echo " (Workflow trigger may need a moment, try manually if needed)"
129+ echo " (Workflow trigger may need a moment — trigger manually if needed)"
149130
150131 echo " Done: ${FORK} "
151132 echo " "
152133done
153134
154135echo " === All community repos set up! ==="
155- echo " Docs will deploy at repos.supermodeltools.com/{repo}/ as workflows complete."
136+ echo " Arch-docs will deploy to supermodeltools.github.io/{repo}/ as workflows complete."
137+ echo " The central site at repos.supermodeltools.com/{repo}/ will proxy there via _redirects."
0 commit comments