Skip to content

Commit 357f9df

Browse files
ci: add Deploy Static Docs workflow (docs-static-build container → CF Pages) (#6384)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 4c1a1f1 commit 357f9df

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Deploy Static Docs
2+
3+
# Renders the published docs site to static HTML and uploads it to Cloudflare
4+
# Pages using the public fernenterprise/docs-static-build container.
5+
#
6+
# Runs AFTER "Publish Docs" completes successfully, so the ledger manifest + CAS
7+
# blobs the container reads from S3 are already up to date. Also runnable
8+
# manually via workflow_dispatch.
9+
#
10+
# The container takes three logical inputs (see the fern-platform astro
11+
# package README): the docs URL, an S3 key to READ the ledger blobs, and a CF
12+
# Pages key to UPLOAD the built site. All are provided as GitHub secrets.
13+
14+
# workflow_run is required so this runs after "Publish Docs" updates the ledger.
15+
# It's safe here: the job checks out no (untrusted) code, is granted no token
16+
# permissions (permissions: {}), and only runs a pinned public container with
17+
# read-only S3 + Cloudflare deploy credentials.
18+
on: # zizmor: ignore[dangerous-triggers]
19+
workflow_run:
20+
workflows: ["Publish Docs"]
21+
types:
22+
- completed
23+
workflow_dispatch:
24+
inputs:
25+
image_tag:
26+
description: "fernenterprise/docs-static-build tag to run"
27+
required: false
28+
default: "latest"
29+
type: string
30+
31+
concurrency:
32+
group: ${{ github.workflow }}
33+
cancel-in-progress: false
34+
35+
permissions: {}
36+
37+
jobs:
38+
deploy:
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 60
41+
# For workflow_run: only proceed when the upstream "Publish Docs" run
42+
# succeeded (a failed/cancelled publish leaves the ledger unchanged, so
43+
# there's nothing new to build). workflow_dispatch runs always proceed.
44+
if: >-
45+
github.event_name == 'workflow_dispatch' ||
46+
github.event.workflow_run.conclusion == 'success'
47+
steps:
48+
- name: Build static docs and deploy to Cloudflare Pages
49+
env:
50+
# 1. Docs URL — the site to build.
51+
NEXT_PUBLIC_DOCS_DOMAIN: fern.docs.buildwithfern.com/learn
52+
# 2. S3 key — read the published ledger manifest + CAS blobs.
53+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
54+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
55+
AWS_REGION: us-east-1
56+
DOCS_DEFINITION_S3_BUCKET_NAME: fdr-prod-docs-definitions-public
57+
CONTENT_ADDRESSABLE_FILES_S3_BUCKET_NAME: fdr-prod-content-addressable-storage
58+
# 3. CF Pages key — upload the built dist/ to Cloudflare Pages.
59+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
60+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
61+
CF_PAGES_PROJECT: ${{ secrets.CF_PAGES_PROJECT }}
62+
CF_PAGES_BRANCH: ${{ secrets.CF_PAGES_BRANCH }}
63+
# Optional: used only to resolve Ask AI enablement at build time.
64+
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
65+
IMAGE_TAG: ${{ github.event.inputs.image_tag || 'latest' }}
66+
run: |
67+
IMAGE="fernenterprise/docs-static-build:${IMAGE_TAG}"
68+
echo "Running $IMAGE for $NEXT_PUBLIC_DOCS_DOMAIN"
69+
docker pull "$IMAGE"
70+
# Forward each secret by name (values come from this step's env), so no
71+
# secret is interpolated into the command line.
72+
docker run --rm \
73+
-e NEXT_PUBLIC_DOCS_DOMAIN \
74+
-e AWS_ACCESS_KEY_ID \
75+
-e AWS_SECRET_ACCESS_KEY \
76+
-e AWS_REGION \
77+
-e DOCS_DEFINITION_S3_BUCKET_NAME \
78+
-e CONTENT_ADDRESSABLE_FILES_S3_BUCKET_NAME \
79+
-e CLOUDFLARE_API_TOKEN \
80+
-e CLOUDFLARE_ACCOUNT_ID \
81+
-e CF_PAGES_PROJECT \
82+
-e CF_PAGES_BRANCH \
83+
-e FERN_TOKEN \
84+
"$IMAGE"

0 commit comments

Comments
 (0)