fix: national olympiad chip said AOAI, correct body is NOAI (matches … #52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Appwrite Sites | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: appwrite-deploy | |
| cancel-in-progress: true | |
| env: | |
| APPWRITE_ENDPOINT: https://fra.cloud.appwrite.io/v1 | |
| APPWRITE_PROJECT: 69e62515000e9e781653 | |
| jobs: | |
| deploy-static: | |
| name: Deploy static site (rollback target) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| # Static site: ship the repo as-is (minus git/CI/SSR internals). | |
| - name: Package site | |
| run: | | |
| tar --exclude='.git' --exclude='.github' --exclude='ssr' -czf /tmp/code.tar.gz . | |
| ls -la /tmp/code.tar.gz | |
| - name: Create + activate deployment | |
| env: | |
| APPWRITE_API_KEY: ${{ secrets.APPWRITE_API_KEY }} | |
| run: | | |
| set -euo pipefail | |
| resp=$(curl -sS -X POST \ | |
| "$APPWRITE_ENDPOINT/sites/portfolio/deployments" \ | |
| -H "X-Appwrite-Project: $APPWRITE_PROJECT" \ | |
| -H "X-Appwrite-Key: $APPWRITE_API_KEY" \ | |
| -F "code=@/tmp/code.tar.gz" \ | |
| -F "activate=true") | |
| dep_id=$(echo "$resp" | python3 -c "import json,sys; print(json.load(sys.stdin)['\$id'])") | |
| echo "deployment: $dep_id" | |
| for i in $(seq 1 30); do | |
| sleep 10 | |
| status=$(curl -sS \ | |
| "$APPWRITE_ENDPOINT/sites/portfolio/deployments/$dep_id" \ | |
| -H "X-Appwrite-Project: $APPWRITE_PROJECT" \ | |
| -H "X-Appwrite-Key: $APPWRITE_API_KEY" \ | |
| | python3 -c "import json,sys; print(json.load(sys.stdin)['status'])") | |
| echo "status: $status" | |
| case "$status" in | |
| ready) echo "static deployed ✔"; exit 0 ;; | |
| failed|canceled) echo "deployment $status" >&2; exit 1 ;; | |
| esac | |
| done | |
| echo "timed out waiting for deployment" >&2 | |
| exit 1 | |
| deploy-ssr: | |
| name: Deploy SSR wrapper (tapiwa.me) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| # The repo root IS the static site; snapshot it into the wrapper. | |
| - name: Assemble site payload | |
| run: | | |
| mkdir -p ssr/site | |
| rsync -a --exclude='.git' --exclude='.github' --exclude='ssr' ./ ssr/site/ | |
| - name: Install + test | |
| working-directory: ssr | |
| run: | | |
| npm ci | |
| npm test | |
| - name: Build bundle | |
| working-directory: ssr | |
| run: | | |
| npm run build:bundle | |
| printf '{\n "name": "portfolio-ssr",\n "private": true,\n "scripts": { "start": "node server.js" }\n}\n' > dist-bundle/package.json | |
| # esbuild ESM->CJS can produce a bundle that boots differently from the | |
| # source; always smoke-run the exact artifact we ship. | |
| - name: Smoke-run bundle | |
| working-directory: ssr/dist-bundle | |
| run: | | |
| PORT=4399 node server.js & | |
| SRV=$! | |
| for i in $(seq 1 20); do | |
| sleep 0.5 | |
| code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:4399/ || true) | |
| [ "$code" = "200" ] && break | |
| done | |
| [ "$code" = "200" ] || { echo "bundle smoke failed (got $code)" >&2; kill $SRV; exit 1; } | |
| hdr=$(curl -s -D- -o /dev/null http://127.0.0.1:4399/ | grep -ci 'x-frame-options: DENY' || true) | |
| kill $SRV | |
| [ "$hdr" = "1" ] || { echo "bundle missing security headers" >&2; exit 1; } | |
| echo "bundle smoke ✔ (200 + headers)" | |
| - name: Package bundle | |
| run: tar -C ssr/dist-bundle -czf /tmp/ssr.tar.gz . | |
| - name: Create + activate deployment | |
| env: | |
| APPWRITE_API_KEY: ${{ secrets.APPWRITE_API_KEY }} | |
| run: | | |
| set -euo pipefail | |
| resp=$(curl -sS -X POST \ | |
| "$APPWRITE_ENDPOINT/sites/portfolio-ssr-preview/deployments" \ | |
| -H "X-Appwrite-Project: $APPWRITE_PROJECT" \ | |
| -H "X-Appwrite-Key: $APPWRITE_API_KEY" \ | |
| -F "code=@/tmp/ssr.tar.gz" \ | |
| -F "activate=true") | |
| dep_id=$(echo "$resp" | python3 -c "import json,sys; print(json.load(sys.stdin)['\$id'])") | |
| echo "deployment: $dep_id" | |
| for i in $(seq 1 30); do | |
| sleep 10 | |
| status=$(curl -sS \ | |
| "$APPWRITE_ENDPOINT/sites/portfolio-ssr-preview/deployments/$dep_id" \ | |
| -H "X-Appwrite-Project: $APPWRITE_PROJECT" \ | |
| -H "X-Appwrite-Key: $APPWRITE_API_KEY" \ | |
| | python3 -c "import json,sys; print(json.load(sys.stdin)['status'])") | |
| echo "status: $status" | |
| case "$status" in | |
| ready) echo "SSR deployed ✔"; exit 0 ;; | |
| failed|canceled) echo "deployment $status" >&2; exit 1 ;; | |
| esac | |
| done | |
| echo "timed out waiting for deployment" >&2 | |
| exit 1 |