Add on-demand workflow to build browser destination bundles#3787
Open
varadarajan-tw wants to merge 4 commits into
Open
Add on-demand workflow to build browser destination bundles#3787varadarajan-tw wants to merge 4 commits into
varadarajan-tw wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
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_dispatchworkflow withenvironmentandbranchinputs. - 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>
…e backend service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 |
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 |
itsarijitray
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build-browser-destinations.ymlworkflow that builds browser destination bundles and uploads them as a GitHub Actions artifactworkflow_dispatch— never runs automaticallyenvironment(constrained choice ofstage|production) andbranch(defaults tomain)build-web-stagefor stage andbuild-webfor production, matching the existing npm scriptsbrowser-destinations-{environment}-{sha}and retained for 7 days, ready for the GitHub App backend to download and upload to S3Test plan