Skip to content

Add on-demand workflow to build browser destination bundles#3787

Open
varadarajan-tw wants to merge 4 commits into
mainfrom
build-browser-destinations-workflow
Open

Add on-demand workflow to build browser destination bundles#3787
varadarajan-tw wants to merge 4 commits into
mainfrom
build-browser-destinations-workflow

Conversation

@varadarajan-tw
Copy link
Copy Markdown
Contributor

@varadarajan-tw varadarajan-tw commented May 12, 2026

Summary

  • Adds a single build-browser-destinations.yml workflow that builds browser destination bundles and uploads them as a GitHub Actions artifact
  • Triggered on demand via workflow_dispatch — never runs automatically
  • Takes two inputs: environment (constrained choice of stage | production) and branch (defaults to main)
  • Runs build-web-stage for stage and build-web for production, matching the existing npm scripts
  • Artifact is named browser-destinations-{environment}-{sha} and retained for 7 days, ready for the GitHub App backend to download and upload to S3

Test plan

  • Testing can be done only after merging to main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 12, 2026 14:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a manually-triggered GitHub Actions workflow to build browser destination bundles for a selected environment and upload the built dist/web/ output as an artifact for later download (e.g., by a backend that uploads to S3).

Changes:

  • Introduces a new workflow_dispatch workflow with environment and branch inputs.
  • Builds the destinations manifest and then builds browser bundles using the existing package scripts.
  • Uploads packages/browser-destinations/dist/web/ as a short-lived artifact.

Comment on lines +48 to +51
uses: actions/upload-artifact@v4
with:
name: browser-destinations-${{ inputs.environment }}-${{ github.sha }}
path: packages/browser-destinations/dist/web/
run: yarn install --frozen-lockfile

- name: Build Destinations Manifest
run: nx build @segment/destinations-manifest
Comment on lines +26 to +30
- uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ inputs.branch }}

- Use git rev-parse HEAD for artifact SHA instead of github.sha (was wrong for non-main branches)
- Add job-level environment to enforce GitHub Environment protection rules
- Add concurrency group to prevent simultaneous builds for the same environment
- Add permissions: contents: read for least-privilege token
- Add NPM_TOKEN and registry-url for authenticated yarn install
- Use yarn nx instead of bare nx to avoid fragile transitive resolution
- Set if-no-files-found: error on artifact upload to catch empty dist
- Increase retention-days to 30 for production deploy artifacts
- Reduce timeout to 20 minutes to match existing browser bundle CI job

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 12, 2026 14:54
…e backend service

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines +13 to +53
branch:
description: Branch to build from
required: true
type: string
default: main

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-22.04
timeout-minutes: 20
environment: ${{ inputs.environment }}
concurrency:
group: build-browser-destinations-${{ inputs.environment }}
cancel-in-progress: false

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 1
ref: ${{ inputs.branch }}

- name: Get checkout SHA
id: sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: 'https://registry.npmjs.org'
cache: yarn

- name: Install Dependencies
run: yarn install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Comment on lines +66 to +68
path: packages/browser-destinations/dist/web/
if-no-files-found: error
retention-days: 30
Copilot AI review requested due to automatic review settings May 12, 2026 15:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +63 to +67
with:
name: browser-destinations-${{ inputs.environment }}-${{ steps.sha.outputs.sha }}
path: packages/browser-destinations/dist/web/
if-no-files-found: error
retention-days: 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants