Skip to content

Commit

Permalink
chore(release): pulling release/2.40.3 into production (#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoumitaM authored Aug 21, 2023
2 parents 872b205 + 5c390e9 commit fa242ed
Show file tree
Hide file tree
Showing 235 changed files with 5,313 additions and 4,136 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-and-quality-checks-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build & Code Quality Checks v3

on:
pull_request:
branches: ['develop', 'main', 'hotfix/*']
types: ['opened', 'reopened', 'synchronize']

jobs:
build:
name: Build & Code Quality Checks v3
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
env:
HUSKY: 0
run: |
npm run setup:ci
- name: Execute quality checks
run: |
npm run check:circular
npm run check:duplicates
- name: Execute security checks
run: |
npm run check:security
- name: Execute bundle size checks
uses: rudderlabs/[email protected]
env:
HUSKY: 0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
install_script: setup:ci
build_script: check:size:build -- --concurrency 1 --scope '@rudderstack/analytics-js' --scope '@rudderstack/analytics-js-common' --scope '@rudderstack/analytics-js-plugins' --scope '@rudderstack/analytics-js-service-worker' --scope 'rudder-sdk-js'
script: npx lerna@6 exec --loglevel=silent --concurrency 1 --scope '@rudderstack/analytics-js' --scope '@rudderstack/analytics-js-common' --scope '@rudderstack/analytics-js-plugins' --scope '@rudderstack/analytics-js-service-worker' --scope 'rudder-sdk-js' -- npm run check:size:json --silent
is_monorepo: true
4 changes: 2 additions & 2 deletions .github/workflows/build-and-quality-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build & Code Quality Checks

on:
pull_request:
branches: ['production', 'production-staging']
branches: ['production', 'production-staging', 'hotfix/*']
types: ['opened', 'reopened', 'synchronize']

jobs:
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
npm run check:security
- name: Execute bundle size checks
uses: rudderlabs/github-action-check-size-limit@v2.4.0
uses: rudderlabs/github-action-check-size-limit@v2.6.0
env:
HUSKY: 0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_pr_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Check PR title

on:
pull_request:
branches: ['production', 'production-staging']
branches: ['production', 'production-staging', 'hotfix/*']
types: ['opened', 'reopened', 'edited', 'synchronize']

jobs:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/create-hotfix-branch-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create new hotfix branch v3

on:
workflow_dispatch:
inputs:
hotfix_name:
description: Hotfix branch name
required: true

jobs:
create-branch:
name: Create new hotfix branch v3
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Create branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'v3-hotfix/${{ github.event.inputs.hotfix_name }}'
54 changes: 36 additions & 18 deletions .github/workflows/deploy-beta-v3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy BETA Feature v3
name: Deploy BETA/BugBash Feature v3

on:
workflow_dispatch:
Expand All @@ -9,15 +9,24 @@ permissions:

jobs:
deploy-tag:
name: Deploy BETA Feature v3
name: Deploy BETA/BugBash Feature v3
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/') # TODO: change value to refs/heads/beta/ before merging
if: startsWith(github.ref, 'refs/heads/beta/') || startsWith(github.ref, 'refs/tags/bugbash')
steps:
- name: Extract feature name from branch
shell: bash
# run: echo "branch=$(echo ${GITHUB_REF#refs/heads/beta})" >>$GITHUB_OUTPUT # TODO: change value to this one
run: echo "branch=v3" >>$GITHUB_OUTPUT
id: extract_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
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -34,24 +43,33 @@ jobs:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Build and sync files to S3
- name: Install dependencies
env:
HUSKY: 0
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/beta/${{ steps.extract_branch.outputs.branch }}/modern/plugins'
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/modern/plugins'
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'beta'
BUGSNAG_RELEASE_STAGE: '${{ steps.extract_branch.outputs.branch_type }}'
run: |
npm run setup:ci
- name: Build release artifacts
env:
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/modern/plugins'
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: '${{ steps.extract_branch.outputs.branch_type }}'
run: |
npm run setup
npm run build:browser
npm run build:browser:modern
npm run build:integrations
- name: Sync files to S3 beta folder
run: |
aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/beta/${{ steps.extract_branch.outputs.branch }}/legacy/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/beta/${{ steps.extract_branch.outputs.branch }}/modern/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-plugins/dist/cdn/legacy/plugins/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/beta/${{ steps.extract_branch.outputs.branch }}/legacy/plugins/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-plugins/dist/cdn/modern/plugins/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/beta/${{ steps.extract_branch.outputs.branch }}/modern/plugins/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-v1.1/dist/legacy/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/beta/${{ steps.extract_branch.outputs.branch }}/legacy/js-integrations/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-v1.1/dist/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/beta/${{ steps.extract_branch.outputs.branch }}/modern/js-integrations/ --recursive --cache-control max-age=3600
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/beta/*"
aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/legacy/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/modern/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-plugins/dist/cdn/modern/plugins/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/modern/plugins/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-integrations/dist/cdn/legacy/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/legacy/js-integrations/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ steps.extract_branch.outputs.branch_type }}/${{ steps.extract_branch.outputs.branch_name }}/modern/js-integrations/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-v1.1/dist/cdn/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 packages/analytics-v1.1/dist/cdn/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 packages/analytics-js-integrations/dist/cdn/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_MAX_ATTEMPTS=10 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 }}/*"
64 changes: 64 additions & 0 deletions .github/workflows/deploy-dev-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Deploy to DEV v3

on:
workflow_dispatch:
pull_request:
branches: ['develop']
types:
- closed

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 to DEV v3
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/v3-hotfix/') || startsWith(github.ref, 'refs/heads/develop/') || github.event.pull_request.merged == true
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_DEV_ACCOUNT_ID }}:role/${{ secrets.AWS_DEV_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: Install dependencies
env:
HUSKY: 0
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/dev/latest/v3/modern/plugins'
BUGSNAG_API_KEY: ${{ secrets.RS_DEV_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'development'
run: |
npm run setup:ci
- name: Build files
env:
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/dev/latest/v3/modern/plugins'
BUGSNAG_API_KEY: ${{ secrets.RS_DEV_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'development'
run: |
npm run build:browser
npm run build:browser:modern
- name: Sync files to S3
run: |
aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/v3/legacy/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/v3/modern/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-plugins/dist/cdn/legacy/plugins/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/v3/legacy/plugins/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-plugins/dist/cdn/modern/plugins/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/v3/modern/plugins/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-integrations/dist/cdn/legacy/js-integrations/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/v3/legacy/js-integrations/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/v3/modern/js-integrations/ --recursive --cache-control max-age=3600
aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/rudder-analytics.min.js --cache-control max-age=3600
aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js.map s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/rudder-analytics.min.js.map --cache-control max-age=3600
aws s3 cp packages/analytics-js-integrations/dist/cdn/legacy/js-integrations/ s3://${{ secrets.AWS_DEV_S3_BUCKET_NAME }}/dev/latest/js-integrations/ --recursive --cache-control max-age=3600
AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DEV_CF_DISTRIBUTION_ID }} --paths "/dev/latest*"
154 changes: 154 additions & 0 deletions .github/workflows/deploy-npm-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Deploy to NPM v3

on:
workflow_dispatch:
pull_request:
branches: ['main']
types:
- closed

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 to NPM v3
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') || github.event.pull_request.merged == true
steps:
- name: Checkout source branch
uses: actions/checkout@v3

- name: Get new version number
run: |
current_version_v1=$(jq -r .version packages/analytics-v1.1/package.json)
current_version_sw=$(jq -r .version packages/analytics-js-service-worker/package.json)
current_version=$(jq -r .version packages/analytics-js/package.json)
echo "CURRENT_VERSION_V1_VALUE=$current_version_v1" >> $GITHUB_ENV
echo "CURRENT_VERSION_SW_VALUE=$current_version_sw" >> $GITHUB_ENV
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
echo "DATE=$(date)" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
env:
HUSKY: 0
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/${{ env.CURRENT_VERSION_VALUE }}/modern/plugins'
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'production'
run: |
npm run setup:ci
- name: Publish package to NPM
env:
HUSKY: 0
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/${{ env.CURRENT_VERSION_VALUE }}/modern/plugins'
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'production'
run: |
npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npx lerna@6 publish from-package --no-private --contents dist/npm
- name: Send message to Slack channel for v3
id: slack
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'JS SDK v3 NPM Package'
NPM_PACKAGE_URL: 'https://www.npmjs.com/package/@rudderstack/analytics-js'
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New release: ${{ env.PROJECT_NAME }}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}"
}
}
]
}
- name: Send message to Slack channel for v1.1
id: slackv1
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'JS SDK 1.1 NPM Package'
NPM_PACKAGE_URL: 'https://www.npmjs.com/package/rudder-sdk-js'
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New release: ${{ env.PROJECT_NAME }}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_V1_VALUE }}>*\n${{ env.DATE }}"
}
}
]
}
- name: Send message to Slack channel for Service Worker
id: slackSw
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'JS SDK Service Worker NPM Package'
NPM_PACKAGE_URL: 'https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker'
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New release: ${{ env.PROJECT_NAME }}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}"
}
}
]
}
Loading

0 comments on commit fa242ed

Please sign in to comment.