1
1
name : XYZ Build
2
2
3
+ env :
4
+ DEFAULT_NOTES : " "
5
+
3
6
on :
4
7
push :
5
8
branches :
9
12
- cloud-function/**
10
13
11
14
workflow_dispatch :
15
+ inputs :
16
+ notes :
17
+ description : " Notes"
18
+ required : false
19
+ default : ${DEFAULT_NOTES}
12
20
13
21
workflow_call :
14
22
secrets :
38
46
- uses : actions/checkout@v3
39
47
40
48
- uses : actions/checkout@v3
49
+ if : ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
41
50
with :
42
51
repository : mdn/content
43
52
path : mdn/content
@@ -48,18 +57,28 @@ jobs:
48
57
fetch-depth : 0
49
58
50
59
- uses : actions/checkout@v3
60
+ if : ${{ ! vars.SKIP_BUILD }}
61
+ with :
62
+ repository : mdn/mdn-studio
63
+ path : mdn/mdn-studio
64
+ token : ${{ secrets.MDN_STUDIO_PAT }}
65
+
66
+ - uses : actions/checkout@v3
67
+ if : ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
51
68
with :
52
69
repository : mdn/translated-content
53
70
path : mdn/translated-content
54
71
# See matching warning for mdn/content checkout step
55
72
fetch-depth : 0
56
73
57
74
- uses : actions/checkout@v3
75
+ if : ${{ ! vars.SKIP_BUILD }}
58
76
with :
59
77
repository : mdn/mdn-contributor-spotlight
60
78
path : mdn/mdn-contributor-spotlight
61
79
62
80
- name : Setup Node.js environment
81
+ if : ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
63
82
uses : actions/setup-node@v3
64
83
with :
65
84
node-version : 18
80
99
CONTENT_ROOT : ${{ github.workspace }}/mdn/content/files
81
100
CONTENT_TRANSLATED_ROOT : ${{ github.workspace }}/mdn/translated-content/files
82
101
CONTRIBUTOR_SPOTLIGHT_ROOT : ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
102
+ BLOG_ROOT : ${{ github.workspace }}/mdn/mdn-studio/content/posts
103
+ BASE_URL : " https://developer.allizom.xyz"
83
104
84
105
# The default for this environment variable is geared for writers
85
106
# (aka. local development). Usually defaults are supposed to be for
97
118
# If it's used on other domains (e.g. stage or dev builds), it's OK
98
119
# because ultimately Google Analytics will filter it out since the
99
120
# origin domain isn't what that account expects.
100
- # BUILD_GOOGLE_ANALYTICS_ACCOUNT: UA-36116321-5
121
+ BUILD_GOOGLE_ANALYTICS_ACCOUNT : UA-36116321-5
101
122
102
123
# This enables the Plus call-to-action banner and the Plus landing page
103
124
REACT_APP_ENABLE_PLUS : true
@@ -117,11 +138,7 @@ jobs:
117
138
REACT_APP_MDN_PLUS_10M_PLAN : price_1K6X7gKb9q6OnNsLi44HdLcC
118
139
REACT_APP_MDN_PLUS_10Y_PLAN : price_1K6X8VKb9q6OnNsLFlUcEiu4
119
140
120
- # Surveys.
121
- REACT_APP_SURVEY_START_CONTENT_DISCOVERY_2023 : 0 # stage
122
- REACT_APP_SURVEY_END_CONTENT_DISCOVERY_2023 : 1677672000000 # (new Date("2023-03-01 12:00:00Z")).getTime()
123
- REACT_APP_SURVEY_RATE_FROM_CONTENT_DISCOVERY_2023 : 0.0
124
- REACT_APP_SURVEY_RATE_TILL_CONTENT_DISCOVERY_2023 : 0.05 # 5%
141
+ # No surveys.
125
142
126
143
# Telemetry.
127
144
REACT_APP_GLEAN_CHANNEL : xyz
@@ -138,6 +155,7 @@ jobs:
138
155
# Info about which CONTENT_* environment variables were set and to what.
139
156
echo "CONTENT_ROOT=$CONTENT_ROOT"
140
157
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT"
158
+ echo "BLOG_ROOT=$BLOG_ROOT"
141
159
# Build the ServiceWorker first
142
160
yarn build:sw
143
161
yarn build:prepare
@@ -149,6 +167,8 @@ jobs:
149
167
150
168
yarn tool sync-translated-content
151
169
170
+ # Build using one process per locale.
171
+ # Note: We have 4 cores, but 9 processes is a reasonable number.
152
172
for locale in en-us es fr ja ko pt-br ru zh-cn zh-tw; do
153
173
yarn build --locale $locale 2>&1 | sed "s/^/[$locale] /" &
154
174
pids+=($!)
@@ -163,6 +183,9 @@ jobs:
163
183
# Generate sitemap index file
164
184
yarn build --sitemap-index
165
185
186
+ # Build the blog
187
+ yarn build:blog
188
+
166
189
# Generate whatsdeployed files.
167
190
yarn tool whatsdeployed --output client/build/_whatsdeployed/code.json
168
191
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
@@ -183,8 +206,8 @@ jobs:
183
206
- name : Sync build with GCS bucket
184
207
if : ${{ ! vars.SKIP_BUILD }}
185
208
run : |
186
- gsutil -q -m cp -r client/build/static gs://${{ vars.GCP_BUCKET_NAME }}/$BUCKET_PATH/static
187
- gsutil -q -m rsync -cdrj html,json,txt client/build gs://${{ vars.GCP_BUCKET_NAME }}/$BUCKET_PATH
209
+ gsutil -q -m -h "Cache-Control: public, max-age=86400" cp -r client/build/static gs://${{ vars.GCP_BUCKET_NAME }}/$BUCKET_PATH/
210
+ gsutil -q -m -h "Cache-Control: public, max-age=86400" rsync -cdrj html,json,txt -y "^static/" client/build gs://${{ vars.GCP_BUCKET_NAME }}/$BUCKET_PATH
188
211
189
212
- name : Generate redirects map
190
213
if : ${{ ! vars.SKIP_FUNCTION }}
@@ -208,9 +231,9 @@ jobs:
208
231
--trigger-http \
209
232
--allow-unauthenticated \
210
233
--entry-point=mdnHandler \
234
+ --concurrency=100 \
211
235
--min-instances=1 \
212
236
--max-instances=100 \
213
- --concurrency=100 \
214
237
--memory=2GB \
215
238
--timeout=30s \
216
239
--set-env-vars="ORIGIN_MAIN=developer.allizom.xyz" \
@@ -221,11 +244,11 @@ jobs:
221
244
--set-env-vars="SENTRY_ENVIRONMENT=xyz" \
222
245
--set-env-vars="SENTRY_TRACES_SAMPLE_RATE=${{ vars.SENTRY_TRACES_SAMPLE_RATE }}" \
223
246
--set-env-vars="SENTRY_RELEASE=${{ github.sha }}" \
224
- --set-secrets="KEVEL_SITE_ID=projects/${{ secrets.WIP_PROJECT_ID }}/secrets/stage-kevel-site-id/versions/latest" \
225
- --set-secrets="KEVEL_NETWORK_ID=projects/${{ secrets.WIP_PROJECT_ID }}/secrets/stage-kevel-network-id/versions/latest" \
226
- --set-secrets="SIGN_SECRET=projects/${{ secrets.WIP_PROJECT_ID }}/secrets/stage-sign-secret/versions/latest" \
227
- --set-secrets="CARBON_ZONE_KEY=projects/${{ secrets.WIP_PROJECT_ID }}/secrets/stage-carbon-zone-key/versions/latest" \
228
- --set-secrets="CARBON_FALLBACK_ENABLED=projects/${{ secrets.WIP_PROJECT_ID }}/secrets/stage-fallback-enabled/versions/latest" \
247
+ --set-secrets="KEVEL_SITE_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-kevel-site-id/versions/latest" \
248
+ --set-secrets="KEVEL_NETWORK_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-kevel-network-id/versions/latest" \
249
+ --set-secrets="SIGN_SECRET=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-sign-secret/versions/latest" \
250
+ --set-secrets="CARBON_ZONE_KEY=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-carbon-zone-key/versions/latest" \
251
+ --set-secrets="CARBON_FALLBACK_ENABLED=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-fallback-enabled/versions/latest" \
229
252
2>&1 | sed "s/^/[$region] /" &
230
253
pids+=($!)
231
254
done
@@ -234,23 +257,6 @@ jobs:
234
257
wait $pid
235
258
done
236
259
237
- invalidate :
238
- environment : xyz
239
- needs : build
240
- if : ${{ ! vars.SKIP_INVALIDATE }}
241
- runs-on : ubuntu-latest
242
-
243
- steps :
244
- - name : Authenticate with GCP
245
- uses : google-github-actions/auth@v0
246
- with :
247
- token_format : access_token
248
- service_account : deploy-xyz-yari@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com
249
- workload_identity_provider : projects/${{ secrets.WIP_PROJECT_ID }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions
250
-
251
- - name : Setup gcloud
252
- uses : google-github-actions/setup-gcloud@v1
253
-
254
260
- name : Invalidate CDN
255
- run : |-
256
- gcloud compute url-maps invalidate-cdn-cache ${{ secrets.GCP_LOAD_BALANCER_NAME }} --path "/*"
261
+ if : ${{ ! vars.SKIP_INVALIDATE }}
262
+ run : gcloud compute url-maps invalidate-cdn-cache ${{ secrets.GCP_LOAD_BALANCER_NAME }} --path "/*" --async
0 commit comments