Skip to content

Commit d1272dd

Browse files
LeoMcAcaugnerfiji-floargl
authored
feat(build): launch fred (#13398)
* chore: update nonprod deploy scripts for fred (#13365) * chore: update prod-build workflow for fred (#13368) * fix(cloud-function): use locale specific 404 page (#13376) * chore(test-build): allow building other fred refs (#13375) * feat(cloudfunction): new formats support in cloud function (#13337) introduce new ad formats to the cloud function * chore(build): copy fred service worker into correct place (#13400) * chore(build): set nonprod updates url (#13385) * fix(csp): add latest fred hash and update comments (#13406) --------- Co-authored-by: Claas Augner <[email protected]> Co-authored-by: Florian Dieminger <[email protected]> Co-authored-by: Andi Pieper <[email protected]>
1 parent 761e5e7 commit d1272dd

File tree

8 files changed

+263
-115
lines changed

8 files changed

+263
-115
lines changed

.github/workflows/prod-build.yml

Lines changed: 61 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,25 @@ jobs:
155155
repository: mdn/mdn-contributor-spotlight
156156
path: mdn/mdn-contributor-spotlight
157157

158+
- uses: actions/checkout@v4
159+
if: ${{ ! vars.SKIP_BUILD }}
160+
with:
161+
repository: mdn/fred
162+
path: mdn/fred
163+
158164
- name: Setup Node.js environment
159165
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
160166
uses: actions/setup-node@v4
161167
with:
162-
node-version-file: mdn/yari/.nvmrc
168+
node-version-file: mdn/fred/.nvmrc
163169

164-
- name: Install all yarn packages
170+
- name: Install all fred packages
165171
if: ${{ ! vars.SKIP_BUILD }}
166-
working-directory: mdn/yari
167-
run: yarn --frozen-lockfile
172+
working-directory: mdn/fred
168173
env:
169174
# Use a GITHUB_TOKEN to bypass rate limiting for rari.
170175
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176+
run: npm ci
171177

172178
- name: Install Python
173179
if: ${{ ! vars.SKIP_BUILD }}
@@ -202,7 +208,7 @@ jobs:
202208

203209
- name: Build everything
204210
if: ${{ ! vars.SKIP_BUILD }}
205-
working-directory: mdn/yari
211+
working-directory: mdn/fred
206212
env:
207213
# Remember, the mdn/content repo got cloned into `pwd` into a
208214
# sub-folder called "mdn/content"
@@ -212,10 +218,11 @@ jobs:
212218
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
213219
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
214220
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
221+
YARI_ROOT: ${{ github.workspace }}/mdn/yari
215222
BASE_URL: "https://developer.mozilla.org"
216223

217224
# rari
218-
BUILD_OUT_ROOT: "client/build"
225+
BUILD_OUT_ROOT: "out"
219226
LIVE_SAMPLES_BASE_URL: https://live.mdnplay.dev
220227
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.mozilla.net
221228
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de
@@ -247,9 +254,11 @@ jobs:
247254
# The default is to always set no to robots. This deployment is the only
248255
# exception in the world where we actually want to welcome robots.
249256
BUILD_ALWAYS_ALLOW_ROBOTS: true
257+
FRED_ROBOTS_GLOBAL_ALLOW: true
250258

251259
# Browser-compat data.
252260
REACT_APP_BCD_BASE_URL: https://bcd.developer.mozilla.org
261+
FRED_BCD_BASE_URL: https://bcd.developer.mozilla.org
253262

254263
# Offline updates
255264
REACT_APP_UPDATES_BASE_URL: https://updates.developer.mozilla.org
@@ -272,15 +281,11 @@ jobs:
272281
REACT_APP_MDN_PLUS_10M_SP3_ID: mdnplus10m
273282
REACT_APP_MDN_PLUS_10Y_SP3_ID: mdnplus10y
274283

275-
# Surveys.
276-
REACT_APP_SURVEY_START_JS_PROPOSALS_2025: 1743120000000 # new Date("2025-03-28Z").getTime()
277-
REACT_APP_SURVEY_END_JS_PROPOSALS_2025: 1744502400000 # new Date("2025-04-13Z").getTime()
278-
REACT_APP_SURVEY_RATE_FROM_JS_PROPOSALS_2025: 0.0
279-
REACT_APP_SURVEY_RATE_TILL_JS_PROPOSALS_2025: 0.05 # 5%
280-
281284
# Telemetry.
282285
REACT_APP_GLEAN_CHANNEL: prod
283286
REACT_APP_GLEAN_ENABLED: true
287+
FRED_GLEAN_CHANNEL: prod
288+
FRED_GLEAN_ENABLED: true
284289

285290
# Newsletter
286291
REACT_APP_NEWSLETTER_ENABLED: true
@@ -290,9 +295,11 @@ jobs:
290295

291296
# Playground
292297
REACT_APP_PLAYGROUND_BASE_HOST: mdnplay.dev
298+
FRED_PLAYGROUND_BASE_HOST: mdnplay.dev
293299

294300
# Observatory
295301
REACT_APP_OBSERVATORY_API_URL: https://observatory-api.mdn.mozilla.net
302+
FRED_OBSERVATORY_API_URL: https://observatory-api.mdn.mozilla.net
296303

297304
# Sentry.
298305
SENTRY_DSN_BUILD: ${{ secrets.SENTRY_DSN_BUILD }}
@@ -310,36 +317,53 @@ jobs:
310317
# Info about which CONTENT_* environment variables were set and to what.
311318
echo "CONTENT_ROOT=$CONTENT_ROOT"
312319
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT"
313-
yarn build:sw
314-
yarn build:client
315-
yarn build:ssr
316-
317-
cp assets/prod/robots.txt client/build/robots.txt
318320
319-
yarn rari content sync-translated-content
320-
yarn rari git-history
321+
mkdir -p out/static
321322
322-
yarn rari build --all --issues client/build/issues.json --templ-stats
323+
npm run rari content sync-translated-content
324+
npm run rari git-history
323325
324-
du -sh client/build
326+
npm run rari build -- --all --issues out/issues.json --templ-stats
325327
326328
# SSR all pages
327-
yarn render:html
329+
npm run build
330+
node build/ssr.js
331+
cp -r dist/* out/static/
332+
cp dist/service-worker/service-worker.js* out/
333+
334+
cp "$YARI_ROOT/assets/prod/robots.txt" out/robots.txt
335+
336+
- name: Install yari yarn packages
337+
if: ${{ ! vars.SKIP_BUILD }}
338+
working-directory: mdn/yari
339+
run: yarn --frozen-lockfile
340+
env:
341+
# Use a GITHUB_TOKEN to bypass rate limiting for rari.
342+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
343+
344+
- name: Run yari scripts
345+
if: ${{ ! vars.SKIP_BUILD }}
346+
working-directory: mdn/yari
347+
env:
348+
FRED_ROOT: ${{ github.workspace }}/mdn/fred
349+
run: |
350+
set -eo pipefail
328351
329352
# Generate whatsdeployed files.
330-
yarn tool:legacy whatsdeployed --output client/build/_whatsdeployed/code.json
331-
yarn tool:legacy whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
332-
yarn tool:legacy whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json
353+
yarn tool:legacy whatsdeployed --output "$FRED_ROOT/out/_whatsdeployed/code.json"
354+
yarn tool:legacy whatsdeployed $CONTENT_ROOT --output "$FRED_ROOT/out/_whatsdeployed/content.json"
355+
yarn tool:legacy whatsdeployed $CONTENT_TRANSLATED_ROOT --output "$FRED_ROOT/out/_whatsdeployed/translated-content.json"
333356
334357
# Sort DE search index by en-US popularity.
335-
node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json
358+
node scripts/reorder-search-index.mjs "$FRED_ROOT/out/en-us/search-index.json" "$FRED_ROOT/out/de/search-index.json"
336359
337360
- name: Update search index
338361
if: ${{ ! vars.SKIP_BUILD }}
339362
working-directory: mdn/yari/deployer
340363
env:
341364
DEPLOYER_ELASTICSEARCH_URL: ${{ secrets.DEPLOYER_PROD_ELASTICSEARCH_URL }}
342-
run: poetry run deployer search-index ../client/build
365+
FRED_ROOT: ${{ github.workspace }}/mdn/fred
366+
run: poetry run deployer search-index "$FRED_ROOT/out"
343367

344368
- name: Authenticate with GCP
345369
if: ${{ ! vars.SKIP_BUILD }}
@@ -355,10 +379,11 @@ jobs:
355379

356380
- name: Sync build
357381
if: ${{ ! vars.SKIP_BUILD }}
358-
working-directory: mdn/yari
382+
working-directory: mdn/fred
359383
run: |-
360-
gsutil -q -m -h "Cache-Control: public, max-age=3600" cp -r client/build/static gs://${{ vars.GCP_BUCKET_NAME }}/main/
361-
gsutil -q -m -h "Cache-Control: public, max-age=3600" rsync -cdrj html,json,txt -y "^static/" client/build gs://${{ vars.GCP_BUCKET_NAME }}/main
384+
time gsutil -q -m -h "Cache-Control: public, max-age=3600" cp -r out/static gs://${{ vars.GCP_BUCKET_NAME }}/main/
385+
time gsutil -q -m -h "Cache-Control: public, max-age=3600" rsync -cr gs://${{ vars.GCP_BUCKET_NAME }}/main/static/ gs://${{ vars.GCP_BUCKET_NAME }}/fred/static/
386+
time gsutil -q -m -h "Cache-Control: public, max-age=3600" rsync -cdrj html,json,txt -y "^static/" out gs://${{ vars.GCP_BUCKET_NAME }}/fred
362387
363388
- name: Authenticate with GCP
364389
if: ${{ ! vars.SKIP_FUNCTION }}
@@ -380,7 +405,10 @@ jobs:
380405
env:
381406
CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files
382407
CONTENT_TRANSLATED_ROOT: ${{ github.workspace }}/mdn/translated-content/files
408+
FRED_ROOT: ${{ github.workspace }}/mdn/fred
383409
run: |-
410+
mkdir -p ../client/build/
411+
cp "$FRED_ROOT/out/sitemap.txt" ../client/build/
384412
npm ci
385413
npm run build-redirects
386414
npm run build-canonicals
@@ -410,7 +438,7 @@ jobs:
410438
--set-env-vars="ORIGIN_MAIN=developer.mozilla.org" \
411439
--set-env-vars="ORIGIN_LIVE_SAMPLES=live.mdnplay.dev" \
412440
--set-env-vars="ORIGIN_PLAY=mdnplay.dev" \
413-
--set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \
441+
--set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/fred/" \
414442
--set-env-vars="SOURCE_API=https://api.developer.mozilla.org/" \
415443
--set-env-vars="ORIGIN_TRIAL_TOKEN=AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=" \
416444
--set-env-vars="BSA_ENABLED=true" \
@@ -432,10 +460,11 @@ jobs:
432460
433461
- name: Update AI Help index with macros
434462
working-directory: mdn/yari
435-
run: yarn ai-help-macros update-index
463+
run: yarn ai-help-macros update-index "$FRED_ROOT/out/en-us/docs"
436464
env:
437465
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
438466
PG_URI: ${{ secrets.PG_URI }}
467+
FRED_ROOT: ${{ github.workspace }}/mdn/fred
439468

440469
- name: Slack Notification
441470
if: failure()

0 commit comments

Comments
 (0)