@@ -2,11 +2,8 @@ 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.
5+ # docs-live feeds the Mintlify docs until the new docs site replaces them. The docs site is
6+ # published and deployed elsewhere; nothing here deploys it.
107on :
118 push :
129 branches :
1714 - " docs-release-*"
1815 workflow_dispatch :
1916
20- # Writes docs-live (Mintlify's GitHub app deploys from it) and comments on waiting commits.
21- permissions :
22- contents : write
17+ permissions : {}
2318
2419concurrency :
2520 group : publish-docs
@@ -28,9 +23,8 @@ concurrency:
2823jobs :
2924 publish :
3025 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 }}
26+ permissions :
27+ contents : write # pushes docs-live (Mintlify's GitHub app deploys from it) and comments on waiting commits
3428 env :
3529 GIT_AUTHOR_NAME : github-actions[bot]
3630 GIT_AUTHOR_EMAIL : 41898282+github-actions[bot]@users.noreply.github.com
8781 git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic $auth" \
8882 push origin "$PUBLISH_SHA:refs/heads/docs-live"
8983
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.
84+ # Comments are a courtesy: a failed one must not fail the run after docs-live moved.
10485 - name : 💬 Comment on docs-only commits that are waiting
10586 if : steps.build.outputs.publish_sha != ''
10687 continue-on-error : true
@@ -119,126 +100,3 @@ jobs:
119100 -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." \
120101 >/dev/null
121102 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@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
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 (Ask AI, its limits, 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, MCP 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-mcp.mjs "$URL/docs"
217- node scripts/check-headers.mjs "$URL/docs"
218-
219- - name : ✅ Promote to production
220- if : steps.config.outputs.enabled == 'true'
221- env :
222- URL : ${{ steps.deploy.outputs.url }}
223- PUBLISH_SHA : ${{ needs.publish.outputs.deploy_sha }}
224- run : |
225- # A rerun of an older run must not put an older tree back over a newer one.
226- head=$(git ls-remote "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" refs/heads/docs-live | cut -f1)
227- if [ "$head" != "$PUBLISH_SHA" ]; then
228- msg="docs-live is at $head now, not $PUBLISH_SHA. Re-run the workflow run for $head instead."
229- echo "::notice title=Docs site not promoted::$msg"
230- echo "### Docs site not promoted: $msg" >> "$GITHUB_STEP_SUMMARY"
231- exit 0
232- fi
233- pnpm dlx "$VERCEL_CLI" promote "$URL" --yes --token="$VERCEL_TOKEN"
234- echo "### Docs site live: $PUBLISH_SHA ($URL)" >> "$GITHUB_STEP_SUMMARY"
235-
236- - name : 📣 Report a failed deploy
237- if : failure()
238- env :
239- PUBLISH_SHA : ${{ needs.publish.outputs.deploy_sha }}
240- run : |
241- msg="The docs site production deploy of $PUBLISH_SHA failed. The previous deployment is still serving; Mintlify publishing from docs-live is unaffected."
242- echo "::error title=Docs site deploy failed::$msg"
243- echo "### Docs site deploy failed" >> "$GITHUB_STEP_SUMMARY"
244- echo "$msg Re-run this job once the cause is fixed." >> "$GITHUB_STEP_SUMMARY"
0 commit comments