Skip to content

Deploy BETA/BugBash Feature #16

Deploy BETA/BugBash Feature

Deploy BETA/BugBash Feature #16

Workflow file for this run

name: Deploy BETA/BugBash Feature
on:
workflow_dispatch:
permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout
jobs:
deploy-tag:
name: Deploy BETA/BugBash Feature
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/beta/') || startsWith(github.ref, 'refs/tags/bugbash')
steps:
- name: Extract feature name from branch
shell: bash
run: |
source_branch_name=${GITHUB_REF##*/}
RELEASE_TYPE=beta
grep -q "bugbash/" <<< "${GITHUB_REF}" && RELEASE_TYPE=bugbash
FEATURE_NAME=${source_branch_name#bugbash/}
FEATURE_NAME=${FEATURE_NAME#beta/}
FEATURE_NAME=${FEATURE_NAME#refs/heads/}
FEATURE_NAME=${FEATURE_NAME#refs/tags/}
echo "branch_name=$FEATURE_NAME" >> $GITHUB_OUTPUT
echo "branch_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
id: extract_branch
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/${{ secrets.AWS_PROD_S3_SYNC_ROLE }}
aws-region: us-east-1
- name: Checkout source branch
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Build and sync files to S3
env:
HUSKY: 0
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'beta'
run: |
npm ci
npm run build:browser
npm run build:integration:all
- name: Sync files to S3 beta folder
run: |
aws s3 cp dist/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/rudder-analytics.min.js --cache-control max-age=3600
aws s3 cp dist/legacy/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/rudder-analytics.min.js.map --cache-control max-age=3600
aws s3 cp dist/legacy/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/js-integrations/ --recursive --cache-control max-age=3600
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/*"