Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .github/workflows/redirects-in-sync.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/render-routes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: render-routes

# Routes for the Render static site are managed in code (redirects.config.js),
# not in the Blueprint — Render Blueprints merge routes, never delete them, and
# cap a service at 200 routes. This workflow validates the consolidated route
# list on every PR, and applies it to Render via the API on pushes to main.
#
# Requires two repo secrets for the apply step:
# RENDER_API_KEY - a Render API key (Account Settings -> API Keys)
# RENDER_SERVICE_ID - the prod "docs" service id (srv-...)

on:
pull_request:
paths:
- redirects.config.js
- scripts/sync-render-routes.mjs
- .github/workflows/render-routes.yml
push:
branches: [main]
paths:
- redirects.config.js
- scripts/sync-render-routes.mjs
- .github/workflows/render-routes.yml

jobs:
routes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

# Build + validate. No secrets needed: uses only Node built-ins and the
# local redirects.config.js. Fails if the consolidated set exceeds Render's
# 200-route cap or has duplicate sources.
- name: Validate routes
run: node scripts/sync-render-routes.mjs

# Apply to Render only on pushes to main.
- name: Apply routes to Render
if: github.ref == 'refs/heads/main'
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RENDER_SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }}
run: node scripts/sync-render-routes.mjs --apply
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"type": "module",
"scripts": {
"dev": "vocs dev",
"sync-redirects": "node scripts/sync-render-redirects.mjs",
"prebuild": "node scripts/sync-render-redirects.mjs",
"build": "vocs build",
"preview": "vocs preview",
"routes:check": "node scripts/sync-render-routes.mjs",
"routes:apply": "node scripts/sync-render-routes.mjs --apply",
"format": "prettier --write ."
},
"dependencies": {
Expand Down
9 changes: 6 additions & 3 deletions redirects.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
*
* Single source of truth for redirects. Consumed in two places:
* - the dev-server redirect middleware in vocs.config.tsx (local `vocs dev`)
* - `npm run sync-redirects`, which splices these into render.yaml so Render
* serves them in production (Vocs has no build-time redirect support).
* - scripts/sync-render-routes.mjs, which consolidates these (collapsing
* prefix groups into wildcard rules to fit Render's 200-route cap) and
* applies them to the Render static site via the API. Routes are NOT in
* render.yaml — Render Blueprints merge routes and never delete them.
*
* After editing, run `npm run sync-redirects` and commit the updated render.yaml.
* To change redirects: edit this file and open a PR. CI validates the resulting
* route count (<=200); merging to main applies them to Render.
*
* Follows the OffchainLabs/arbitrum-docs redirects.config.js pattern. Kept as a
* `.js` module (types in redirects.config.d.ts) so it resolves natively in both
Expand Down
Loading
Loading