Skip to content

chore: Add current url to Session Replay and Session Trace payloads (… #1006

chore: Add current url to Session Replay and Session Trace payloads (…

chore: Add current url to Session Replay and Session Trace payloads (… #1006

Workflow file for this run

# This workflow runs on push to the main branch. This is to execute checks
# like jest, upload test coverage to keep codecov updates, and build and deploy
# the main branch changes to our internal dev and stage environment. This workflow
# can be manually executed but only on the main branch.
name: Publish Dev
on:
workflow_dispatch:
push:
branches:
- 'main'
# Only allow one instance of this workflow to run at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
jest-tests:
if: github.ref == 'refs/heads/main'
name: Jest tests
uses: ./.github/workflows/jest.yml
secrets: inherit
with:
coverage: true
wdio-coverage:
if: github.ref == 'refs/heads/main'
name: WDIO coverage
uses: ./.github/workflows/wdio-single-browser.yml
with:
browser-target: chrome@latest
coverage: true
secrets: inherit
# Build and publish the latest code from the main branch
publish-dev-to-s3:
needs: [jest-tests]
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install project dependencies
run: npm ci
- name: Build dev
run: npm run cdn:build:dev
- name: Upload dev
id: s3-upload
uses: ./.github/actions/s3-upload
with:
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 }}
local_dir: $GITHUB_WORKSPACE/build
bucket_dir: dev/
- name: Gather cdn purge paths
id: dev-purge-paths
run: echo "results=$(echo '${{ steps.s3-upload.outputs.results }}' | jq -j '.[].Key + " "')" >> $GITHUB_OUTPUT
- name: Purge production cdn
uses: ./.github/actions/fastly-purge
with:
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
fastly_service: js-agent.newrelic.com
purge_path: ${{ steps.dev-purge-paths.outputs.results }}
- name: Purge staging cdn
uses: ./.github/actions/fastly-purge
with:
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
fastly_service: staging-js-agent.newrelic.com
purge_path: ${{ steps.dev-purge-paths.outputs.results }}
- name: Verify production cdn assets
uses: ./.github/actions/fastly-verify
with:
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
fastly_service: js-agent.newrelic.com
asset_path: ${{ join(fromJson(steps.s3-upload.outputs.results).*.Key, ' ') }}
- name: Verify staging cdn assets
uses: ./.github/actions/fastly-verify
with:
fastly_key: ${{ secrets.FASTLY_PURGE_KEY }}
fastly_service: staging-js-agent.newrelic.com
asset_path: ${{ join(fromJson(steps.s3-upload.outputs.results).*.Key, ' ') }}
# Publish dev to staging NRDB
# publish-dev-nr:
# needs: [publish-dev-to-s3]
# runs-on: ubuntu-latest
# timeout-minutes: 30
# defaults:
# run:
# shell: bash
# steps:
# - uses: actions/checkout@v4
# with:
# ref: main
# - uses: actions/setup-node@v4
# with:
# node-version: lts/*
# - name: Publish dev loader to nr
# uses: ./.github/actions/nr-upload-dev
# with:
# nr_stage_api_key: ${{ secrets.NR_API_KEY_STAGING }}
# Rebuild and publish the dev environment A/B script
publish-dev-ab:
needs: [publish-dev-to-s3]
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Publish dev a/b script
uses: ./.github/actions/internal-ab
with:
nr_environment: dev
nrba_app_id: ${{ secrets.INTERNAL_DEV_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
nrba_ab_app_id: ${{ secrets.INTERNAL_AB_DEV_APPLICATION_ID }}
nrba_ab_license_key: ${{ secrets.INTERNAL_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 }}
# Rebuild and publish the staging environment A/B script
publish-staging-ab:
needs: [publish-dev-to-s3]
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Deploy staging a/b script
uses: ./.github/actions/internal-ab
with:
nr_environment: staging
nrba_app_id: ${{ secrets.INTERNAL_STAGING_APPLICATION_ID }}
nrba_license_key: ${{ secrets.INTERNAL_LICENSE_KEY }}
nrba_ab_app_id: ${{ secrets.INTERNAL_AB_STAGING_APPLICATION_ID }}
nrba_ab_license_key: ${{ secrets.INTERNAL_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 }}