-
Notifications
You must be signed in to change notification settings - Fork 67
536 lines (488 loc) · 23 KB
/
Copy pathinternal-promotion.yml
File metadata and controls
536 lines (488 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# This workflow is used to manually deploy a specific Browser Agent version
# to NR1 environments by updating the "released" asset that NR1 pages load.
# This workflow enforces a strict sequential promotion path:
# dev -> staging -> jp-prod -> eu-prod -> us-prod
# Each environment requires manual approval via GitHub Environment protection rules.
#
# Two deployment modes:
# 1. Release Candidate (default when no input provided): Builds fresh RC assets
# from current branch and uploads to environment-specific CDN paths
# 2. Existing Version: Promotes an already-published CDN version (for rollbacks)
name: Internal Promotion
on:
workflow_dispatch:
inputs:
deployment_source:
description: 'Leave empty to build from current branch, or provide version number/CDN URL'
required: false
type: string
default: ''
pull_request:
types: [opened, synchronize]
branches:
- main
permissions:
contents: read
id-token: write
# Cancel previous dev deployments when PR is updated
concurrency:
group: ${{ github.event_name == 'pull_request' && format('dev-deploy-{0}', github.event.pull_request.number) || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Determine deployment mode and resolve version for non-RC deployments
resolve-version:
# Only run for manual dispatch or release-please PRs
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please--'))
runs-on: ubuntu-latest
outputs:
is_rc_mode: ${{ steps.determine-mode.outputs.is_rc_mode }}
script_url: ${{ steps.resolve-cdn-path.outputs.script_url }}
version_label: ${{ steps.resolve-cdn-path.outputs.version_label }}
steps:
- name: Determine deployment mode
id: determine-mode
run: |
CDN_PATH="${{ inputs.deployment_source }}"
if [[ -z "$CDN_PATH" ]]; then
echo "is_rc_mode=true" >> $GITHUB_OUTPUT
echo "🚀 Release Candidate mode: Will build fresh from current branch for each environment"
else
echo "is_rc_mode=false" >> $GITHUB_OUTPUT
echo "📦 Specific version mode: Will use provided version/URL"
fi
- name: Resolve CDN path for specific version mode
if: steps.determine-mode.outputs.is_rc_mode == 'false'
id: resolve-cdn-path
run: |
CDN_PATH="${{ inputs.deployment_source }}"
if [[ "$CDN_PATH" =~ ^https?:// ]]; then
# Full URL provided
SCRIPT_URL="$CDN_PATH"
VERSION_LABEL="$CDN_PATH"
elif [[ "$CDN_PATH" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+ ]]; then
# RC version number provided (e.g., "1.314.0-rc.1")
SCRIPT_URL="https://js-agent.newrelic.com/nr-loader-spa-${CDN_PATH}.min.js"
VERSION_LABEL="$CDN_PATH"
elif [[ "$CDN_PATH" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Released version number provided (e.g., "1.314.0")
SCRIPT_URL="https://js-agent.newrelic.com/nr-loader-spa-${CDN_PATH}.min.js"
VERSION_LABEL="v${CDN_PATH}"
else
echo "❌ Invalid deployment_source format: $CDN_PATH"
echo ""
echo "Valid formats:"
echo " - (empty) - builds from current branch (default)"
echo " - Released version: 1.314.0 (for rollbacks)"
echo " - RC version: 1.314.0-rc.1 (for re-promotion of specific RC)"
echo " - Full URL: https://js-agent.newrelic.com/nr-loader-spa-1.314.0.min.js"
exit 1
fi
echo "script_url=$SCRIPT_URL" >> $GITHUB_OUTPUT
echo "version_label=$VERSION_LABEL" >> $GITHUB_OUTPUT
echo "✅ Resolved CDN path: $SCRIPT_URL"
echo "📋 Version label: $VERSION_LABEL"
# Step 1: Deploy to Dev (runs first)
deploy-dev:
needs: [resolve-version]
runs-on: ubuntu-latest
environment: nr1-dev
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.11.0
# Determine branch name for webpack version suffix
- name: Determine branch name for version
id: branch-name
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BRANCH="${{ github.head_ref }}"
else
BRANCH="${{ github.ref_name }}"
fi
# Clean branch name for version suffix (lowercase, replace special chars with hyphens)
CLEAN_BRANCH=$(echo "$BRANCH" | sed 's/[^a-zA-Z0-9-]/-/g' | tr '[:upper:]' '[:lower:]')
echo "branch_name=${CLEAN_BRANCH}" >> $GITHUB_OUTPUT
echo "🏷️ Using branch-specific version suffix: ${CLEAN_BRANCH}"
# Build and deploy RC assets
- name: Deploy RC assets for dev
if: needs.resolve-version.outputs.is_rc_mode == 'true'
id: deploy-rc
uses: ./.github/actions/deploy-rc-assets
with:
environment: dev
bucket_dir: dev/
cdn_service: js-agent.newrelic.com
branch_name: ${{ steps.branch-name.outputs.branch_name }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
- name: Promote agent to Dev
uses: ./.github/actions/internal-promotion
with:
nr_environment: dev
nrba_released_script_url: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.script_url || needs.resolve-version.outputs.script_url }}
nrba_app_id: ${{ secrets.INTERNAL_DEV_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
outputs:
version_label: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.version_label || needs.resolve-version.outputs.version_label }}
# Create change tracking event for dev
create-dev-change-tracking:
needs: [deploy-dev]
environment: change-tracking
runs-on: Browser-Agent-Assigned-IP-Linux
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Create dev change tracking event (Account 1067061)
uses: ./.github/actions/change-tracking
with:
accountId: '1067061'
entityGuid: ${{ secrets.NR_ENTITY_GUID_NR1_DEV }}
apiKey: ${{ secrets.NR_CHANGE_TRACKING_API_KEY_NR1 }}
region: 'Dev'
version: ${{ needs.deploy-dev.outputs.version_label }}
type: 'Basic'
description: 'Dev promoted to ${{ needs.deploy-dev.outputs.version_label }}'
shortDescription: 'Dev: ${{ needs.deploy-dev.outputs.version_label }}'
deepLink: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
commit: ${{ github.sha }}
user: ${{ github.actor }}
groupId: '${{ github.run_id }}-${{ github.sha }}'
# Step 2: Deploy to Staging
deploy-staging:
# For workflow_dispatch: only on main or release-please branches
# For pull_request: only release-please PRs
if: |
(github.event_name == 'workflow_dispatch' && (github.ref_name == 'main' || startsWith(github.ref_name, 'release-please--'))) ||
(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please--'))
needs: [resolve-version, deploy-dev]
runs-on: ubuntu-latest
environment: nr1-staging
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.11.0
# Build and deploy RC assets
- name: Deploy RC assets for staging
if: needs.resolve-version.outputs.is_rc_mode == 'true'
id: deploy-rc
uses: ./.github/actions/deploy-rc-assets
with:
environment: staging
bucket_dir: staging/
cdn_service: js-agent.newrelic.com
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
- name: Promote agent to Staging
uses: ./.github/actions/internal-promotion
with:
nr_environment: staging
nrba_released_script_url: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.script_url || needs.resolve-version.outputs.script_url }}
nrba_app_id: ${{ secrets.INTERNAL_STAGING_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
outputs:
version_label: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.version_label || needs.resolve-version.outputs.version_label }}
# Create change tracking event for staging
create-staging-change-tracking:
needs: [deploy-staging]
environment: change-tracking
runs-on: Browser-Agent-Assigned-IP-Linux
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Create staging change tracking event (Account 1067061)
uses: ./.github/actions/change-tracking
with:
accountId: '1067061'
entityGuid: ${{ secrets.NR_ENTITY_GUID_NR1_STAGING }}
apiKey: ${{ secrets.NR_CHANGE_TRACKING_API_KEY_NR1 }}
region: 'Staging'
version: ${{ needs.deploy-staging.outputs.version_label }}
type: 'Basic'
description: 'Staging promoted to ${{ needs.deploy-staging.outputs.version_label }}'
shortDescription: 'Staging: ${{ needs.deploy-staging.outputs.version_label }}'
deepLink: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
commit: ${{ github.sha }}
user: ${{ github.actor }}
groupId: '${{ github.run_id }}-${{ github.sha }}'
# Notify staging deployment
notify-staging:
needs: [resolve-version, deploy-staging]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Send Slack notification
uses: ./.github/actions/slack-notification
with:
notifications_channel_url: ${{ secrets.SLACK_BROWSER_AGENT_NOTIFICATIONS_WEBHOOK_URL }}
dem_platform_ops_channel_url: ${{ secrets.SLACK_DEM_PLATFORM_OPS_WEBHOOK_URL }}
message: ":rocket: New Browser Agent version promoted to \\`staging\\` environment. See <https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }}|workflow run>."
# Step 3: Deploy to EU Production
deploy-eu-prod:
needs: [resolve-version, deploy-staging]
runs-on: ubuntu-latest
environment: nr1-eu-prod
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.11.0
# Build and deploy RC assets
- name: Deploy RC assets for eu-prod
if: needs.resolve-version.outputs.is_rc_mode == 'true'
id: deploy-rc
uses: ./.github/actions/deploy-rc-assets
with:
environment: eu-prod
bucket_dir: eu-prod/
cdn_service: js-agent.newrelic.com
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
- name: Promote agent to EU Production
uses: ./.github/actions/internal-promotion
with:
nr_environment: eu-prod
nrba_released_script_url: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.script_url || needs.resolve-version.outputs.script_url }}
nrba_app_id: ${{ secrets.INTERNAL_EU_PRODUCTION_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
outputs:
version_label: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.version_label || needs.resolve-version.outputs.version_label }}
# Create change tracking event for EU production
create-eu-prod-change-tracking:
needs: [deploy-eu-prod]
environment: change-tracking
runs-on: Browser-Agent-Assigned-IP-Linux
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Create EU production change tracking event (Account 1067061)
uses: ./.github/actions/change-tracking
with:
accountId: '1067061'
entityGuid: ${{ secrets.NR_ENTITY_GUID_NR1_EU_PROD }}
apiKey: ${{ secrets.NR_CHANGE_TRACKING_API_KEY_NR1 }}
region: 'EU'
version: ${{ needs.deploy-eu-prod.outputs.version_label }}
type: 'Rolling'
description: 'EU production promoted to ${{ needs.deploy-eu-prod.outputs.version_label }}'
shortDescription: 'EU Prod: ${{ needs.deploy-eu-prod.outputs.version_label }}'
deepLink: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
commit: ${{ github.sha }}
user: ${{ github.actor }}
groupId: '${{ github.run_id }}-${{ github.sha }}'
# Notify EU production deployment
notify-eu-prod:
needs: [resolve-version, deploy-eu-prod]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Send Slack notification
uses: ./.github/actions/slack-notification
with:
notifications_channel_url: ${{ secrets.SLACK_BROWSER_AGENT_NOTIFICATIONS_WEBHOOK_URL }}
dem_platform_ops_channel_url: ${{ secrets.SLACK_DEM_PLATFORM_OPS_WEBHOOK_URL }}
message: ":rocket: New Browser Agent version promoted to \\`eu-prod\\` environment. See <https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }}|workflow run>."
# Step 4: Deploy to Japan Production
deploy-jp-prod:
needs: [resolve-version, deploy-eu-prod]
runs-on: ubuntu-latest
environment: nr1-jp-prod
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.11.0
# Build and deploy RC assets
- name: Deploy RC assets for jp-prod
if: needs.resolve-version.outputs.is_rc_mode == 'true'
id: deploy-rc
uses: ./.github/actions/deploy-rc-assets
with:
environment: jp-prod
bucket_dir: jp-prod/
cdn_service: js-agent.newrelic.com
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
- name: Promote agent to JP Production
uses: ./.github/actions/internal-promotion
with:
nr_environment: jp-prod
nrba_released_script_url: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.script_url || needs.resolve-version.outputs.script_url }}
nrba_app_id: ${{ secrets.INTERNAL_JP_PRODUCTION_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
outputs:
version_label: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.version_label || needs.resolve-version.outputs.version_label }}
# Create change tracking event for JP production
create-jp-prod-change-tracking:
needs: [deploy-jp-prod]
environment: change-tracking
runs-on: Browser-Agent-Assigned-IP-Linux
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Create JP production change tracking event (Account 1067061)
uses: ./.github/actions/change-tracking
with:
accountId: '1067061'
entityGuid: ${{ secrets.NR_ENTITY_GUID_NR1_JP_PROD }}
apiKey: ${{ secrets.NR_CHANGE_TRACKING_API_KEY_NR1 }}
region: 'JP'
version: ${{ needs.deploy-jp-prod.outputs.version_label }}
type: 'Rolling'
description: 'JP production promoted to ${{ needs.deploy-jp-prod.outputs.version_label }}'
shortDescription: 'JP Prod: ${{ needs.deploy-jp-prod.outputs.version_label }}'
deepLink: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
commit: ${{ github.sha }}
user: ${{ github.actor }}
groupId: '${{ github.run_id }}-${{ github.sha }}'
# Notify JP production deployment
notify-jp-prod:
needs: [resolve-version, deploy-jp-prod]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Send Slack notification
uses: ./.github/actions/slack-notification
with:
notifications_channel_url: ${{ secrets.SLACK_BROWSER_AGENT_NOTIFICATIONS_WEBHOOK_URL }}
dem_platform_ops_channel_url: ${{ secrets.SLACK_DEM_PLATFORM_OPS_WEBHOOK_URL }}
message: ":rocket: New Browser Agent version promoted to \\`jp-prod\\` environment. See <https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }}|workflow run>."
# Step 5: Deploy to US Production
deploy-us-prod:
needs: [resolve-version, deploy-jp-prod]
runs-on: ubuntu-latest
environment: nr1-us-prod
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.11.0
# Build and deploy RC assets
- name: Deploy RC assets for us-prod
if: needs.resolve-version.outputs.is_rc_mode == 'true'
id: deploy-rc
uses: ./.github/actions/deploy-rc-assets
with:
environment: us-prod
bucket_dir: prod/
cdn_service: js-agent.newrelic.com
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
- name: Promote agent to US Production
uses: ./.github/actions/internal-promotion
with:
nr_environment: prod
nrba_released_script_url: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.script_url || needs.resolve-version.outputs.script_url }}
nrba_app_id: ${{ secrets.INTERNAL_PRODUCTION_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_role: ${{ secrets.AWS_ROLE_ARN }}
aws_bucket_name: ${{ secrets.AWS_BUCKET }}
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
outputs:
version_label: ${{ needs.resolve-version.outputs.is_rc_mode == 'true' && steps.deploy-rc.outputs.version_label || needs.resolve-version.outputs.version_label }}
# Create change tracking event for US production
create-us-prod-change-tracking:
needs: [deploy-us-prod]
environment: change-tracking
runs-on: Browser-Agent-Assigned-IP-Linux
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Create US production change tracking event (Account 1067061)
uses: ./.github/actions/change-tracking
with:
accountId: '1067061'
entityGuid: ${{ secrets.NR_ENTITY_GUID_NR1_US_PROD }}
apiKey: ${{ secrets.NR_CHANGE_TRACKING_API_KEY_NR1 }}
region: 'US'
version: ${{ needs.deploy-us-prod.outputs.version_label }}
type: 'Rolling'
description: 'US production promoted to ${{ needs.deploy-us-prod.outputs.version_label }}'
shortDescription: 'US Prod: ${{ needs.deploy-us-prod.outputs.version_label }}'
deepLink: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
commit: ${{ github.sha }}
user: ${{ github.actor }}
groupId: '${{ github.run_id }}-${{ github.sha }}'
# Notify US production deployment
notify-us-prod:
needs: [resolve-version, deploy-us-prod]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Send Slack notification
uses: ./.github/actions/slack-notification
with:
notifications_channel_url: ${{ secrets.SLACK_BROWSER_AGENT_NOTIFICATIONS_WEBHOOK_URL }}
dem_platform_ops_channel_url: ${{ secrets.SLACK_DEM_PLATFORM_OPS_WEBHOOK_URL }}
message: ":rocket: New Browser Agent version promoted to \\`us-prod\\` environment. See <https://github.com/newrelic/newrelic-browser-agent/actions/runs/${{ github.run_id }}|workflow run>."
# Verify promotion status for PR gating
# This job can be used as a required status check to block release-please PR merges
# until full production promotion completes, while allowing normal PRs to pass through
verify-promotion:
runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request'
needs: [deploy-us-prod]
timeout-minutes: 5
steps:
- name: Verify promotion complete
run: |
if [[ "${{ github.head_ref }}" =~ ^release-please-- ]]; then
# For release-please PRs, require successful promotion to production
if [[ "${{ needs.deploy-us-prod.result }}" != "success" ]]; then
echo "❌ Release-please PR: Production promotion did not complete successfully"
echo "Deploy status: ${{ needs.deploy-us-prod.result }}"
exit 1
fi
echo "✅ Release-please PR: Full production promotion completed successfully"
else
echo "✅ Normal PR: No promotion required"
fi