Skip to content

Commit 82a1b55

Browse files
ericallamTrigger.dev RepoOps
authored andcommitted
feat(docs): Fumadocs docs site
Mono-RevId: a67cd1a862beaf671c80aaf9360a31d9c5d7145f
1 parent 8e14c98 commit 82a1b55

145 files changed

Lines changed: 9786 additions & 294 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/rules/docs-writing.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ paths:
55

66
# Documentation Writing Rules
77

8-
- Use Mintlify MDX format. Frontmatter: `title`, `description`, `sidebarTitle` (optional).
8+
- MDX rendered by the docs site in `apps/docs`; `docs/AGENTS.md` has the full guide, including what each CI check failure means. Frontmatter: `title`, `description`, `sidebarTitle` (optional).
99
- After creating a new page, add it to `docs.json` navigation under the correct group.
10-
- Use Mintlify components: `<Note>`, `<Warning>`, `<Info>`, `<Tip>`, `<CodeGroup>`, `<Expandable>`, `<Steps>`/`<Step>`.
10+
- Components: `<Note>`, `<Warning>`, `<Info>`, `<Tip>`, `<CodeGroup>`, `<Expandable>`, `<Steps>`/`<Step>` (Mintlify's names and props).
11+
- Moving or deleting a page: add a `redirects` entry in `docs.json`.
12+
- Check with `pnpm --filter docs-site check --links` (fast), or build and run `check` for everything CI runs.
1113
- Code examples should be complete and runnable where possible.
1214
- Always import from `@trigger.dev/sdk`, never `@trigger.dev/sdk/v3`.
1315
- Keep paragraphs short. Use headers to break up content.

‎.github/workflows/docs.yml‎

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ on:
77
paths:
88
- ".github/workflows/docs.yml"
99
- "docs/**"
10+
- "apps/docs/**"
11+
# No paths filter on pull requests or the merge queue: `check` can be a required check, and a
12+
# workflow a paths filter skips leaves a required check pending. `changes` skips `check` (a pass)
13+
# instead.
1014
pull_request:
1115
types: [opened, synchronize, reopened]
12-
paths:
13-
- ".github/workflows/docs.yml"
14-
- "docs/**"
16+
merge_group:
1517

1618
concurrency:
1719
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -21,33 +23,90 @@ permissions:
2123
contents: read
2224

2325
jobs:
24-
check-broken-links:
25-
runs-on: warp-ubuntu-latest-x64-2x
26-
defaults:
27-
run:
28-
working-directory: ./docs
26+
changes:
27+
name: changes
28+
if: github.event_name != 'push'
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 5
31+
permissions:
32+
contents: read # the merge group's commits, to diff them
33+
pull-requests: read # a pull request's changed files
34+
outputs:
35+
docs: ${{ steps.filter.outputs.docs }}
36+
steps:
37+
# A merge group is diffed in git (as in pr_checks.yml); a pull request through the API.
38+
- name: 📥 Checkout repository
39+
if: github.event_name == 'merge_group'
40+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41+
with:
42+
fetch-depth: 20
43+
filter: blob:none
44+
persist-credentials: false
45+
46+
# Renamed files match on their old path too, so moving a page out of docs/ still runs the check.
47+
- name: 🔎 Docs changed?
48+
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
49+
id: filter
50+
with:
51+
filters: |
52+
docs:
53+
- ".github/workflows/docs.yml"
54+
- "docs/**"
55+
- "apps/docs/**"
56+
57+
# Builds the docs site (apps/docs) and runs its checks: every internal link and #anchor
58+
# resolves, and every published docs URL and redirect still answers.
59+
check:
60+
name: check
61+
needs: changes
62+
# Pushes (paths-filtered above) skip `changes`. A pull request or merge group skips this only
63+
# when `changes` found no docs files; if `changes` failed, this runs.
64+
if: ${{ !cancelled() && (github.event_name == 'push' || needs.changes.outputs.docs != 'false') }}
65+
runs-on: warp-ubuntu-latest-x64-4x
66+
timeout-minutes: 20
2967
steps:
3068
- name: 📥 Checkout repository
3169
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3270
with:
3371
persist-credentials: false
3472

35-
- name: 📦 Install Mintlify
36-
working-directory: ${{ runner.temp }}
73+
- name: ⎔ Setup pnpm
74+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
75+
with:
76+
version: 10.33.2
77+
78+
- name: ⎔ Setup node
79+
uses: WarpBuilds/setup-node@2867cf8f859d73439e1ad18b542617e5a29f0f10 # v7.0.0
80+
with:
81+
node-version: 24.22.1
82+
cache: "pnpm"
83+
84+
# Turbopack and Twoslash caches: a warm build takes about a quarter of a cold one's time and
85+
# half its memory. Keyed on the lockfile and the docs sources; any older docs cache still helps.
86+
- name: 💾 Restore the docs build cache
87+
uses: WarpBuilds/cache@dad44e2487e9dc889ad6e6bd198e77bb2d828eee # v2.0.0
88+
with:
89+
path: apps/docs/.next/cache
90+
key: docs-next-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('apps/docs/**', 'docs/**') }}
91+
restore-keys: |
92+
docs-next-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-
93+
94+
- name: 📦 Install the docs site
95+
run: pnpm install --frozen-lockfile --filter docs-site...
96+
97+
# Code samples get type hovers checked against the SDK's own types.
98+
- name: 🏗️ Build the SDK types
99+
run: pnpm --filter docs-site build:sdk
100+
101+
- name: 🧪 Unit tests
102+
run: pnpm --filter docs-site test
103+
104+
- name: 🏗️ Build the docs site
105+
run: pnpm --filter docs-site build
106+
env:
107+
NEXT_TELEMETRY_DISABLED: "1"
108+
109+
- name: 🔗 Check links and URLs
110+
run: pnpm --filter docs-site check
37111
env:
38-
COREPACK_HOME: ${{ runner.temp }}/mintlify-corepack
39-
NPM_CONFIG_CACHE: ${{ runner.temp }}/mintlify-npm-cache
40-
NPM_CONFIG_GLOBALCONFIG: /dev/null
41-
NPM_CONFIG_USERCONFIG: /dev/null
42-
PNPM_HOME: ${{ runner.temp }}/mintlify-pnpm
43-
run: |
44-
mkdir -p "$RUNNER_TEMP/mintlify-tool"
45-
printf '{"private":true}\n' >"$RUNNER_TEMP/mintlify-tool/package.json"
46-
corepack pnpm@10.33.2 --dir "$RUNNER_TEMP/mintlify-tool" add \
47-
--save-exact \
48-
--store-dir "$RUNNER_TEMP/mintlify-pnpm-store" \
49-
--registry=https://registry.npmjs.org/ \
50-
mintlify@4.0.393
51-
52-
- name: 🔗 Check for broken links
53-
run: '"$RUNNER_TEMP/mintlify-tool/node_modules/.bin/mintlify" broken-links'
112+
NEXT_TELEMETRY_DISABLED: "1"

‎.github/workflows/publish-docs.yml‎

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: 📚 Publish docs
22

33
# Docs-only commits on main publish on merge. Anything else waits for a
44
# docs-release-* tag. See .github/scripts/publish-docs.sh.
5+
#
6+
# Every new docs-live commit is also deployed as the docs site's (apps/docs) production
7+
# deployment, checked before it takes the production domain. That job skips with a notice
8+
# until its secrets exist: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_DOCS_PROJECT_ID and
9+
# VERCEL_AUTOMATION_BYPASS_SECRET.
510
on:
611
push:
712
branches:
@@ -23,6 +28,9 @@ concurrency:
2328
jobs:
2429
publish:
2530
runs-on: warp-ubuntu-latest-x64-2x
31+
outputs:
32+
publish_sha: ${{ steps.build.outputs.publish_sha }}
33+
deploy_sha: ${{ steps.target.outputs.deploy_sha }}
2634
env:
2735
GIT_AUTHOR_NAME: github-actions[bot]
2836
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
@@ -79,8 +87,23 @@ jobs:
7987
git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic $auth" \
8088
push origin "$PUBLISH_SHA:refs/heads/docs-live"
8189
90+
# A manual run with nothing new to publish redeploys docs-live as it is: the way to recover
91+
# a production deploy that a failed or skipped run left behind.
92+
- name: 🎯 Pick the tree to deploy
93+
id: target
94+
env:
95+
PUBLISH_SHA: ${{ steps.build.outputs.publish_sha }}
96+
run: |
97+
sha="$PUBLISH_SHA"
98+
if [ -z "$sha" ] && [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
99+
sha=$(git ls-remote "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" refs/heads/docs-live | cut -f1)
100+
fi
101+
echo "deploy_sha=$sha" >> "$GITHUB_OUTPUT"
102+
103+
# Comments are a courtesy: a failed one must not stop the deploy of what was just pushed.
82104
- name: 💬 Comment on docs-only commits that are waiting
83105
if: steps.build.outputs.publish_sha != ''
106+
continue-on-error: true
84107
env:
85108
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86109
run: |
@@ -96,3 +119,125 @@ jobs:
96119
-f body="This docs-only change is waiting for the next docs release: $why. It will go live with the next \`docs-release-*\` tag that includes it." \
97120
>/dev/null
98121
done <"$RUNNER_TEMP/new-waiting"
122+
123+
# Builds the tree just pushed to docs-live, deploys it without the production domain, checks
124+
# the deployment, then promotes it. A failed step leaves the previous deployment serving.
125+
deploy-site:
126+
name: deploy-site
127+
needs: publish
128+
# Pushes, tags and manual runs only: never on a pull request, which can't reach these secrets anyway.
129+
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.publish.outputs.deploy_sha != ''
130+
runs-on: warp-ubuntu-latest-x64-4x
131+
timeout-minutes: 20
132+
permissions:
133+
contents: read
134+
# One production deploy at a time, in order, so an older tree never promotes last.
135+
concurrency:
136+
group: docs-production
137+
cancel-in-progress: false
138+
env:
139+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
140+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
141+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }}
142+
VERCEL_CLI: vercel@65.14.0
143+
NEXT_TELEMETRY_DISABLED: "1"
144+
steps:
145+
- name: 🔑 Check deploy settings
146+
id: config
147+
run: |
148+
if [ -z "$VERCEL_TOKEN" ] || [ -z "$VERCEL_ORG_ID" ] || [ -z "$VERCEL_PROJECT_ID" ]; then
149+
echo "::notice title=Docs site deploy skipped::VERCEL_TOKEN, VERCEL_ORG_ID or VERCEL_DOCS_PROJECT_ID is not set."
150+
echo "enabled=false" >> "$GITHUB_OUTPUT"
151+
else
152+
echo "enabled=true" >> "$GITHUB_OUTPUT"
153+
fi
154+
155+
- name: 📥 Checkout docs-live
156+
if: steps.config.outputs.enabled == 'true'
157+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
158+
with:
159+
ref: ${{ needs.publish.outputs.deploy_sha }}
160+
# History (without old file contents) gives each page its last-modified date in the
161+
# sitemap, JSON-LD and .md; a shallow clone builds without them.
162+
fetch-depth: 0
163+
filter: blob:none
164+
persist-credentials: false
165+
166+
- name: ⎔ Setup pnpm
167+
if: steps.config.outputs.enabled == 'true'
168+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
169+
with:
170+
version: 10.33.2
171+
172+
- name: ⎔ Setup node
173+
if: steps.config.outputs.enabled == 'true'
174+
uses: WarpBuilds/setup-node@2867cf8f859d73439e1ad18b542617e5a29f0f10 # v7.0.0
175+
with:
176+
node-version: 24.22.1
177+
cache: "pnpm"
178+
179+
- name: 💾 Restore the docs build cache
180+
if: steps.config.outputs.enabled == 'true'
181+
uses: WarpBuilds/cache@dad44e2487e9dc889ad6e6bd198e77bb2d828eee # v2.0.0
182+
with:
183+
path: apps/docs/.next/cache
184+
key: docs-next-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('apps/docs/**', 'docs/**') }}
185+
restore-keys: |
186+
docs-next-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-
187+
188+
# The project's root directory is apps/docs; its vercel.json installs only the docs site.
189+
- name: ⚙️ Pull project settings
190+
if: steps.config.outputs.enabled == 'true'
191+
run: pnpm dlx "$VERCEL_CLI" pull --yes --environment=production --token="$VERCEL_TOKEN"
192+
193+
# The build stops if a production setting (analytics) is missing.
194+
- name: 🏗️ Build
195+
if: steps.config.outputs.enabled == 'true'
196+
env:
197+
VERCEL_ENV: production
198+
run: pnpm dlx "$VERCEL_CLI" build --prod --token="$VERCEL_TOKEN"
199+
200+
- name: 🚀 Deploy without the production domain
201+
id: deploy
202+
if: steps.config.outputs.enabled == 'true'
203+
run: |
204+
url=$(pnpm dlx "$VERCEL_CLI" deploy --prebuilt --prod --skip-domain --token="$VERCEL_TOKEN")
205+
echo "url=$url" >> "$GITHUB_OUTPUT"
206+
207+
- name: 🔗 Check URLs and headers on the deployment
208+
if: steps.config.outputs.enabled == 'true'
209+
working-directory: apps/docs
210+
env:
211+
URL: ${{ steps.deploy.outputs.url }}
212+
# Deployment URLs sit behind the project's Vercel Authentication until promoted.
213+
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
214+
run: |
215+
node scripts/check-urls.mjs "$URL/docs" --live
216+
node scripts/check-headers.mjs "$URL/docs"
217+
218+
- name: ✅ Promote to production
219+
if: steps.config.outputs.enabled == 'true'
220+
env:
221+
URL: ${{ steps.deploy.outputs.url }}
222+
PUBLISH_SHA: ${{ needs.publish.outputs.deploy_sha }}
223+
run: |
224+
# A rerun of an older run must not put an older tree back over a newer one.
225+
head=$(git ls-remote "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" refs/heads/docs-live | cut -f1)
226+
if [ "$head" != "$PUBLISH_SHA" ]; then
227+
msg="docs-live is at $head now, not $PUBLISH_SHA. Re-run the workflow run for $head instead."
228+
echo "::notice title=Docs site not promoted::$msg"
229+
echo "### Docs site not promoted: $msg" >> "$GITHUB_STEP_SUMMARY"
230+
exit 0
231+
fi
232+
pnpm dlx "$VERCEL_CLI" promote "$URL" --yes --token="$VERCEL_TOKEN"
233+
echo "### Docs site live: $PUBLISH_SHA ($URL)" >> "$GITHUB_STEP_SUMMARY"
234+
235+
- name: 📣 Report a failed deploy
236+
if: failure()
237+
env:
238+
PUBLISH_SHA: ${{ needs.publish.outputs.deploy_sha }}
239+
run: |
240+
msg="The docs site production deploy of $PUBLISH_SHA failed. The previous deployment is still serving; Mintlify publishing from docs-live is unaffected."
241+
echo "::error title=Docs site deploy failed::$msg"
242+
echo "### Docs site deploy failed" >> "$GITHUB_STEP_SUMMARY"
243+
echo "$msg Re-run this job once the cause is fixed." >> "$GITHUB_STEP_SUMMARY"

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ v3 (engine V1: MarQS + Graphile worker) is end-of-life and its execution code ha
176176

177177
### Documentation
178178

179-
Docs live in `docs/` as a Mintlify site (MDX format). See `docs/AGENTS.md` for conventions.
179+
Docs live in `docs/` as MDX, rendered by the docs site in `apps/docs`. See `docs/AGENTS.md` for conventions and checks.
180180

181181
### Reference Projects
182182

‎ai/references/repo.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This is a pnpm 10.33.2 monorepo that uses turborepo @turbo.json. The following w
3030

3131
## Other
3232

33-
- <root>/docs is our trigger.dev/docs mintlify documentation site
33+
- <root>/docs is our trigger.dev/docs documentation content (MDX), rendered by the docs site in <root>/apps/docs
3434
- <root>/docker/Dockerfile is the one that creates the main trigger.dev published image
3535
- <root>/docker/docker-compose.yml is the file we run locally to start postgresql, redis, and electric when we are doing local development. You can run it with `pnpm run docker`
3636
- <root>/CONTRIBUTING.md defines the steps it takes for OSS contributors to start contributing.

‎apps/docs/.env.example‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copy to .env.local. Every setting is optional locally: without any of them you get the docs with
2+
# search and no analytics. The table in README.md, "Settings", says what each one does and which a
3+
# production build requires.
4+
5+
# Analytics. Unset: no events.
6+
# NEXT_PUBLIC_POSTHOG_KEY=
7+
# Default: https://eu.i.posthog.com
8+
# NEXT_PUBLIC_POSTHOG_HOST=
9+
10+
# The dashboard the Dashboard link opens. Default: https://cloud.trigger.dev
11+
# NEXT_PUBLIC_DASHBOARD_URL=http://localhost:3030
12+
13+
# Another server for the API playground (a local or staging API).
14+
# DOCS_API_SERVER_URL=http://localhost:3030
15+
# Hosts other than localhost that may load `next dev` (comma-separated).
16+
# DOCS_DEV_ORIGINS=
17+
# Build tuning: see README.md, "Dev server" and "SDK types in the docs".
18+
# DOCS_TWOSLASH=
19+
# DOCS_BUILD_CPUS=
20+
21+
# Checks against a preview behind Vercel Authentication (check-urls, check-headers).
22+
# VERCEL_AUTOMATION_BYPASS_SECRET=

‎apps/docs/.gitignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.next/
2+
.source/
3+
next-env.d.ts
4+
*.tsbuildinfo
5+
.generated/
6+
public/

‎apps/docs/AGENTS.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- BEGIN:nextjs-agent-rules -->
2+
3+
## This is NOT the Next.js you know
4+
5+
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
6+
7+
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
8+
9+
<!-- END:nextjs-agent-rules -->

0 commit comments

Comments
 (0)