-
Notifications
You must be signed in to change notification settings - Fork 40
80 lines (77 loc) · 3.71 KB
/
publish-internal.yml
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
# This workflow is used to build and publish the
# agent script loaded on our internal NR1 environments.
name: Publish Internal
on:
workflow_dispatch:
inputs:
nr_environment:
description: 'Target New Relic environment'
required: true
type: choice
options:
- dev
- staging
- prod
- eu-prod
nrba_released_script_url:
description: 'URL for the script to use as the latest released version NRBA loader.'
required: false
default: https://js-agent.newrelic.com/nr-loader-spa-current.min.js
nrba_latest_script_url:
description: 'URL for the script to use as the latest unreleased version NRBA loader.'
required: false
default: https://js-agent.newrelic.com/dev/nr-loader-spa.min.js
jobs:
publish-internal:
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Prepare target environment
id: target-environment
run: |
if [[ "${{ inputs.nr_environment }}" == "prod" ]]; then
echo "nrba_app_id=${{ secrets.INTERNAL_PRODUCTION_APPLICATION_ID }}" >> $GITHUB_OUTPUT
echo "nrba_license_key=${{ secrets.INTERNAL_LICENSE_KEY }}" >> $GITHUB_OUTPUT
echo "nrba_ab_app_id=" >> $GITHUB_OUTPUT
echo "nrba_ab_license_key=" >> $GITHUB_OUTPUT
elif [[ "${{ inputs.nr_environment }}" == "eu-prod" ]]; then
echo "nrba_app_id=${{ secrets.INTERNAL_EU_PRODUCTION_APPLICATION_ID }}" >> $GITHUB_OUTPUT
echo "nrba_license_key=${{ secrets.INTERNAL_LICENSE_KEY }}" >> $GITHUB_OUTPUT
echo "nrba_ab_app_id=" >> $GITHUB_OUTPUT
echo "nrba_ab_license_key=" >> $GITHUB_OUTPUT
elif [[ "${{ inputs.nr_environment }}" == "staging" ]]; then
echo "nrba_app_id=${{ secrets.INTERNAL_STAGING_APPLICATION_ID }}" >> $GITHUB_OUTPUT
echo "nrba_license_key=${{ secrets.INTERNAL_LICENSE_KEY }}" >> $GITHUB_OUTPUT
echo "nrba_ab_app_id=${{ secrets.INTERNAL_AB_STAGING_APPLICATION_ID }}" >> $GITHUB_OUTPUT
echo "nrba_ab_license_key=${{ secrets.INTERNAL_AB_LICENSE_KEY }}" >> $GITHUB_OUTPUT
elif [[ "${{ inputs.nr_environment }}" == "dev" ]]; then
echo "nrba_app_id=${{ secrets.INTERNAL_DEV_APPLICATION_ID }}" >> $GITHUB_OUTPUT
echo "nrba_license_key=${{ secrets.INTERNAL_LICENSE_KEY }}" >> $GITHUB_OUTPUT
echo "nrba_ab_app_id=${{ secrets.INTERNAL_AB_DEV_APPLICATION_ID }}" >> $GITHUB_OUTPUT
echo "nrba_ab_license_key=${{ secrets.INTERNAL_AB_LICENSE_KEY }}" >> $GITHUB_OUTPUT
else
echo "Invalid environment select"
exit 1
fi
- name: Deploy prod a/b script
uses: ./.github/actions/internal-ab
with:
nr_environment: ${{ inputs.nr_environment }}
nrba_released_script_url: ${{ inputs.nrba_released_script_url }}
nrba_latest_script_url: ${{ inputs.nrba_latest_script_url }}
nrba_app_id: ${{ steps.target-environment.outputs.nrba_app_id }}
nrba_license_key: ${{ steps.target-environment.outputs.nrba_license_key }}
nrba_ab_app_id: ${{ steps.target-environment.outputs.nrba_ab_app_id }}
nrba_ab_license_key: ${{ steps.target-environment.outputs.nrba_ab_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 }}