diff --git a/.github/workflows/check_pr_title.yml b/.github/workflows/check_pr_title.yml index 45651d9a0..d69bdba5e 100644 --- a/.github/workflows/check_pr_title.yml +++ b/.github/workflows/check_pr_title.yml @@ -1,17 +1,14 @@ -name: Check PR title +name: Check PR Title on: pull_request: - branches: [ 'main', 'develop', 'hotfix/*', 'v3-hotfix/*'] + branches: ['main', 'develop', 'hotfix/*'] types: ['opened', 'reopened', 'edited', 'synchronize'] jobs: check_pr_title: name: Check PR title - runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, X64] steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Check PR title uses: rudderlabs/github-action-check-pr-title@v1.0.9 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 57ee9e6ea..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,70 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: 'CodeQL' - -on: - push: - branches: [main, develop] - pull_request: - # The branches below must be a subset of the branches above - branches: [main, develop] - schedule: - - cron: '0 0 * * *' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: ['javascript', 'typescript'] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/create-hotfix-branch-v3.yml b/.github/workflows/create-hotfix-branch.yml similarity index 67% rename from .github/workflows/create-hotfix-branch-v3.yml rename to .github/workflows/create-hotfix-branch.yml index 26e0d7da9..9de391e7d 100644 --- a/.github/workflows/create-hotfix-branch-v3.yml +++ b/.github/workflows/create-hotfix-branch.yml @@ -1,4 +1,4 @@ -name: Create new hotfix branch v3 +name: Create a new hotfix branch on: workflow_dispatch: @@ -9,8 +9,8 @@ on: jobs: create-branch: - name: Create new hotfix branch v3 - runs-on: ubuntu-latest + name: Create a new hotfix branch + runs-on: [self-hosted, Linux, X64] if: github.ref == 'refs/heads/main' steps: - name: Create branch @@ -18,4 +18,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - branch: 'v3-hotfix/${{ github.event.inputs.hotfix_name }}' + branch: 'hotfix/${{ github.event.inputs.hotfix_name }}' diff --git a/.github/workflows/deploy-beta-v3.yml b/.github/workflows/deploy-beta.yml similarity index 88% rename from .github/workflows/deploy-beta-v3.yml rename to .github/workflows/deploy-beta.yml index d76b3501b..a3b8207e5 100644 --- a/.github/workflows/deploy-beta-v3.yml +++ b/.github/workflows/deploy-beta.yml @@ -1,4 +1,4 @@ -name: Deploy BETA/BugBash Feature v3 +name: Deploy BETA/BugBash Feature on: workflow_dispatch: @@ -12,7 +12,7 @@ env: jobs: deploy-tag: - name: Deploy BETA/BugBash Feature v3 + name: Deploy BETA/BugBash Feature runs-on: [self-hosted, Linux, X64] if: startsWith(github.ref, 'refs/heads/beta/') || startsWith(github.ref, 'refs/tags/bugbash') @@ -20,6 +20,12 @@ jobs: - name: Install AWS cli uses: unfor19/install-aws-cli-action@master + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + 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: Extract feature name from branch id: extract_branch shell: bash @@ -35,12 +41,6 @@ jobs: echo "branch_name=$FEATURE_NAME" >> $GITHUB_OUTPUT echo "branch_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - 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 uses: actions/checkout@v4 @@ -68,15 +68,27 @@ jobs: npm run build:browser npm run build:browser:modern - - name: Sync files to S3 beta folder + - name: Sync files to S3 beta directory run: | 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 + + - name: Create Cloudfront invalidation + run: | + 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 }}/*" + + + # Below steps are for v1.1 SDK (legacy) + - name: Sync files to S3 beta directory (v1.1) + run: | 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 + + - name: Create Cloudfront invalidation + run: | 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 }}/*" diff --git a/.github/workflows/deploy-dev-v3.yml b/.github/workflows/deploy-dev.yml similarity index 84% rename from .github/workflows/deploy-dev-v3.yml rename to .github/workflows/deploy-dev.yml index ed4ef1424..d82de23cf 100644 --- a/.github/workflows/deploy-dev-v3.yml +++ b/.github/workflows/deploy-dev.yml @@ -1,4 +1,4 @@ -name: Deploy to DEV v3 +name: Deploy to Development Environment on: workflow_dispatch: @@ -16,15 +16,15 @@ env: jobs: deploy-tag: - name: Deploy to DEV v3 + name: Deploy to development environment runs-on: [self-hosted, Linux, X64] - 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 + if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/hotfix/') || startsWith(github.ref, 'refs/heads/develop/') || github.event.pull_request.merged == true steps: - name: Install AWS cli uses: unfor19/install-aws-cli-action@master - - name: Configure AWS Credentials + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::${{ secrets.AWS_DEV_ACCOUNT_ID }}:role/${{ secrets.AWS_DEV_S3_SYNC_ROLE }} @@ -65,7 +65,19 @@ jobs: 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 + + - name: Create Cloudfront invalidation + run: | + AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DEV_CF_DISTRIBUTION_ID }} --paths "/dev/latest/v3*" + + # Below steps are for v1.1 SDK (legacy) + + - name: Sync files to S3 (v1.1) + run: | 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 + + - name: Create Cloudfront invalidation + run: | AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DEV_CF_DISTRIBUTION_ID }} --paths "/dev/latest*" diff --git a/.github/workflows/deploy-npm-v3.yml b/.github/workflows/deploy-npm.yml similarity index 98% rename from .github/workflows/deploy-npm-v3.yml rename to .github/workflows/deploy-npm.yml index e2bade57b..394f4124b 100644 --- a/.github/workflows/deploy-npm-v3.yml +++ b/.github/workflows/deploy-npm.yml @@ -1,4 +1,4 @@ -name: Deploy to NPM v3 +name: Deploy to NPM on: workflow_dispatch: @@ -16,8 +16,8 @@ env: jobs: deploy-tag: - name: Deploy to NPM v3 - runs-on: ubuntu-latest + name: Deploy to NPM + runs-on: [self-hosted, Linux, X64] if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') || github.event.pull_request.merged == true steps: @@ -103,13 +103,13 @@ jobs: ] } - - name: Send message to Slack channel for v1.1 - id: slackv1 + - name: Send message to Slack channel for Service Worker + id: slackSw uses: slackapi/slack-github-action@v1.25.0 env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - PROJECT_NAME: 'JS SDK v1.1 NPM Package' - NPM_PACKAGE_URL: 'https://www.npmjs.com/package/rudder-sdk-js' + 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: | @@ -129,20 +129,19 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_V1_VALUE }}>*\n${{ env.DATE }}" + "text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}" } } ] } - - - name: Send message to Slack channel for Service Worker - id: slackSw + - name: Send message to Slack channel for v1.1 + id: slackv1 uses: slackapi/slack-github-action@v1.25.0 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' + PROJECT_NAME: 'JS SDK v1.1 NPM Package' + NPM_PACKAGE_URL: 'https://www.npmjs.com/package/rudder-sdk-js' with: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | @@ -162,7 +161,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}" + "text": "*Release: <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_V1_VALUE }}>*\n${{ env.DATE }}" } } ] diff --git a/.github/workflows/deploy-prod-v3.yml b/.github/workflows/deploy-prod.yml similarity index 87% rename from .github/workflows/deploy-prod-v3.yml rename to .github/workflows/deploy-prod.yml index 91923cfba..ef888f3fa 100644 --- a/.github/workflows/deploy-prod-v3.yml +++ b/.github/workflows/deploy-prod.yml @@ -1,7 +1,29 @@ -name: Deploy to PROD v3 +name: Deploy to Production Environment on: - workflow_dispatch: + workflow_call: + inputs: + action_type: + description: 'Type of action' + type: string + required: false + default: '' + secrets: + AWS_PROD_ACCOUNT_ID: + required: true + AWS_PROD_S3_BUCKET_NAME: + required: true + AWS_PROD_S3_SYNC_ROLE: + required: true + AWS_PROD_CF_DISTRIBUTION_ID: + required: true + RS_PROD_BUGSNAG_API_KEY: + required: true + SLACK_BOT_TOKEN: + required: true + SLACK_RELEASE_CHANNEL_ID: + required: true + pull_request: branches: ['main'] types: @@ -16,15 +38,15 @@ env: jobs: deploy-tag: - name: Deploy to PROD v3 + name: Deploy to production environment runs-on: [self-hosted, Linux, X64] - if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') || github.event.pull_request.merged == true + if: github.event_name == 'workflow_call' || (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') || github.event.pull_request.merged == true) steps: - - name: Install AWS cli + - name: Install AWS CLI uses: unfor19/install-aws-cli-action@master - - name: Configure AWS Credentials + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/${{ secrets.AWS_PROD_S3_SYNC_ROLE }} @@ -65,34 +87,13 @@ jobs: npm run build:browser npm run build:browser:modern - - name: Sync file to S3 adobe-analytics-js assets folder + - name: Sync Adobe Analytics assets to S3 run: | aws s3 cp assets/integrations/AdobeAnalytics/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/adobe-analytics-js --recursive --cache-control max-age=3600 - aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/adobe-analytics-js*" - - - name: Sync files to S3 v1.1 folder - run: | - aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/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 }}/v1.1/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 }}/v1.1/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/rudder-analytics.min.js --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/rudder-analytics.min.js.map --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/list_integration_sdks.html --cache-control max-age=3600 - AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/v1.1*" - - name: Sync files to S3 v1.1 versioned folder + - name: Create Cloudfront invalidation run: | - aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/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 }}/${{ env.CURRENT_VERSION_V1_VALUE }}/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 }}/${{ env.CURRENT_VERSION_V1_VALUE }}/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/rudder-analytics.min.js --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/rudder-analytics.min.js.map --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/list_integration_sdks.html --cache-control max-age=3600 - AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ env.CURRENT_VERSION_V1_VALUE }}*" + aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/adobe-analytics-js*" - name: Sync files to S3 v3 folder run: | @@ -101,6 +102,9 @@ jobs: aws s3 cp packages/analytics-js-plugins/dist/cdn/modern/plugins/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v3/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 }}/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_PROD_S3_BUCKET_NAME }}/v3/modern/js-integrations/ --recursive --cache-control max-age=3600 + + - name: Create Cloudfront invalidation + run: | AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/v3/*" - name: Sync files to S3 v3 versioned folder @@ -110,16 +114,14 @@ jobs: aws s3 cp packages/analytics-js-plugins/dist/cdn/modern/plugins/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_VALUE }}/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 }}/${{ env.CURRENT_VERSION_VALUE }}/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 }}/${{ env.CURRENT_VERSION_VALUE }}/modern/js-integrations/ --recursive --cache-control max-age=3600 + + - name: Create Cloudfront invalidation + run: | AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ env.CURRENT_VERSION_VALUE }}/*" + # TODO: The '/latest' folder is unused. Might be removed in future. - name: Sync files to S3 latest run: | - aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/latest/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/rudder-analytics.min.js --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/rudder-analytics.min.js.map --cache-control max-age=3600 aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/js-integrations/ --recursive --cache-control max-age=3600 aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/list_integration_sdks.html --cache-control max-age=3600 aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/v3/legacy/ --recursive --cache-control max-age=3600 @@ -127,6 +129,9 @@ jobs: aws s3 cp packages/analytics-js-plugins/dist/cdn/modern/plugins/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/latest/v3/modern/js-integrations/ --recursive --cache-control max-age=3600 + + - name: Create Cloudfront invalidation + run: | AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/latest*" - name: Send message to Slack channel v3 @@ -134,7 +139,7 @@ jobs: uses: slackapi/slack-github-action@v1.25.0 env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - PROJECT_NAME: 'JS SDK v3 Browser Package' + PROJECT_NAME: 'JS SDK v3 Browser Package${{ github.event.inputs.action_type }}' CDN_URL: 'https://cdn.rudderlabs.com/v3/modern/rsa.min.js' with: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} @@ -161,12 +166,58 @@ jobs: ] } + + # Below steps are for v1.1 SDK (legacy) + + - name: Sync files to S3 v1.1 folder + run: | + aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/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 }}/v1.1/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 }}/v1.1/js-integrations/ --recursive --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/list_integration_sdks.html --cache-control max-age=3600 + aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/rudder-analytics.min.js --cache-control max-age=3600 + aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/rudder-analytics.min.js.map --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/js-integrations/ --recursive --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/list_integration_sdks.html --cache-control max-age=3600 + + - name: Create Cloudfront invalidation + run: | + AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/v1.1*" + + - name: Sync files to S3 v1.1 versioned folder + run: | + aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/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 }}/${{ env.CURRENT_VERSION_V1_VALUE }}/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 }}/${{ env.CURRENT_VERSION_V1_VALUE }}/js-integrations/ --recursive --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/list_integration_sdks.html --cache-control max-age=3600 + aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/rudder-analytics.min.js --cache-control max-age=3600 + aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/rudder-analytics.min.js.map --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/js-integrations/ --recursive --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/list_integration_sdks.html --cache-control max-age=3600 + + - name: Create Cloudfront invalidation + run: | + AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ env.CURRENT_VERSION_V1_VALUE }}*" + + - name: Sync files to S3 latest (v1.1) + run: | + aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/latest/js-integrations/ --recursive --cache-control max-age=3600 + aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/list_integration_sdks.html --cache-control max-age=3600 + aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/rudder-analytics.min.js --cache-control max-age=3600 + aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/rudder-analytics.min.js.map --cache-control max-age=3600 + + - name: Create Cloudfront invalidation + run: | + AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/latest*" + - name: Send message to Slack channel id: slackv1 uses: slackapi/slack-github-action@v1.25.0 env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - PROJECT_NAME: 'JS SDK v1.1 Browser Package' + PROJECT_NAME: 'JS SDK v1.1 Browser Package${{ github.event.inputs.action_type }}' CDN_URL: 'https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js' with: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} diff --git a/.github/workflows/deploy-sanity-suite.yml b/.github/workflows/deploy-sanity-suite.yml index ee9a11cad..a17adc1c8 100644 --- a/.github/workflows/deploy-sanity-suite.yml +++ b/.github/workflows/deploy-sanity-suite.yml @@ -27,7 +27,7 @@ jobs: - name: Install AWS cli uses: unfor19/install-aws-cli-action@master - - name: Configure AWS Credentials + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/${{ secrets.AWS_PROD_S3_SYNC_ROLE }} diff --git a/.github/workflows/deploy-staging-v3.yml b/.github/workflows/deploy-staging.yml similarity index 74% rename from .github/workflows/deploy-staging-v3.yml rename to .github/workflows/deploy-staging.yml index 98fdf2e7d..f0d30a4ac 100644 --- a/.github/workflows/deploy-staging-v3.yml +++ b/.github/workflows/deploy-staging.yml @@ -1,7 +1,13 @@ -name: Deploy to STAGING v3 +name: Deploy to Staging Environment on: workflow_dispatch: + pull_request: + branches: ['main'] + types: + - opened + - synchronize + - reopened permissions: id-token: write # allows the JWT to be requested from GitHub's OIDC provider @@ -12,15 +18,17 @@ env: jobs: deploy-tag: - name: Deploy to STAGING v3 + name: Deploy to staging environment runs-on: [self-hosted, Linux, X64] - if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/v3-hotfix-release') || startsWith(github.ref, 'refs/heads/v3-release') || startsWith(github.ref, 'refs/heads/v3-hotfix/') + # Only run the workflow to be manually run for tags + # and PRs raised from release branches to main + if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/hotfix-release') || startsWith(github.ref, 'refs/heads/release') steps: - name: Install AWS cli uses: unfor19/install-aws-cli-action@master - - name: Configure AWS Credentials + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::${{ secrets.AWS_STAGING_ACCOUNT_ID }}:role/${{ secrets.AWS_STAGING_S3_SYNC_ROLE }} @@ -48,31 +56,32 @@ jobs: HUSKY: 0 REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/staging/latest/v3/modern/plugins' BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }} - BUGSNAG_RELEASE_STAGE: 'development' + BUGSNAG_RELEASE_STAGE: 'staging' run: | npm run setup:ci - - name: Build assets + - name: Build files env: REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/staging/latest/v3/modern/plugins' BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }} - BUGSNAG_RELEASE_STAGE: 'development' + BUGSNAG_RELEASE_STAGE: 'staging' run: | npm run build:browser npm run build:browser:modern - - name: Build LH assets - env: - REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/staging/latest/v3/modern/plugins' - BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }} - BUGSNAG_RELEASE_STAGE: 'development' - BUNDLED_PLUGINS: 'StorageEncryptionLegacy,XhrQueue' + - name: Sync files to S3 v3 staging folder + run: | + aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/staging/latest/v3/legacy/ --recursive --cache-control max-age=3600 + aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/staging/latest/v3/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 }}/staging/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_PROD_S3_BUCKET_NAME }}/staging/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_PROD_S3_BUCKET_NAME }}/staging/latest/v3/modern/js-integrations/ --recursive --cache-control max-age=3600 + + - name: Create Cloudfront invalidation for v3 run: | - export BUNDLED_PLUGINS='StorageEncryptionLegacy,XhrQueue' - npm run clean:cache - cd packages/analytics-js - npm run build:browser:LH + AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/staging/latest/v3*" + # Below steps are for v1.1 SDK (legacy) - name: Sync files to S3 v1.1 staging folder run: | aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}/staging/latest/v1.1/rudder-analytics.min.js --cache-control max-age=3600 @@ -81,19 +90,7 @@ jobs: aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}/staging/latest/v1.1/modern/rudder-analytics.min.js --cache-control max-age=3600 aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}/staging/latest/v1.1/modern/rudder-analytics.min.js.map --cache-control max-age=3600 aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}/staging/latest/v1.1/modern/js-integrations/ --recursive --cache-control max-age=3600 - AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DISTRIBUTION_ID }} --paths "/staging/latest/v1.1*" - - name: Sync files to S3 v3 staging folder + - name: Create Cloudfront invalidation for v1.1 run: | - aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/staging/latest/v3/legacy/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/staging/latest/v3/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 }}/staging/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_PROD_S3_BUCKET_NAME }}/staging/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_PROD_S3_BUCKET_NAME }}/staging/latest/v3/modern/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 "/staging/latest/v3*" - - - name: Sync files to S3 v3 LH staging folder - run: | - aws s3 cp packages/analytics-js/dist/dynamicCdnBundle/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/staging/latest/v3/dynamicCdnBundle/legacy/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js/dist/dynamicCdnBundle/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/staging/latest/v3/dynamicCdnBundle/modern/ --recursive --cache-control max-age=3600 - AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/staging/latest/v3/dynamicCdnBundle*" + AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DISTRIBUTION_ID }} --paths "/staging/latest/v1.1*" diff --git a/.github/workflows/draft-new-release-v3.yml b/.github/workflows/draft-new-release.yml similarity index 90% rename from .github/workflows/draft-new-release-v3.yml rename to .github/workflows/draft-new-release.yml index d9d9b3926..595bf98c6 100644 --- a/.github/workflows/draft-new-release-v3.yml +++ b/.github/workflows/draft-new-release.yml @@ -1,4 +1,4 @@ -name: Draft new release v3 +name: Draft a new release on: workflow_dispatch: @@ -8,11 +8,11 @@ env: jobs: draft-new-release: - name: Draft a new release v3 - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/v3-hotfix/') + name: Draft a new release + runs-on: [self-hosted, Linux, X64] + if: startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/') steps: - - name: Checkout source branch + - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 @@ -43,8 +43,8 @@ jobs: HUSKY: 0 run: | source_branch_name=${GITHUB_REF##*/} - release_type=v3-release - grep -q "v3-hotfix/" <<< "${GITHUB_REF}" && release_type=v3-hotfix-release + release_type=release + grep -q "hotfix/" <<< "${GITHUB_REF}" && release_type=hotfix-release git fetch origin main git fetch --tags origin git merge origin/main @@ -100,4 +100,4 @@ jobs: github_token: ${{ secrets.PAT }} pr_title: 'chore(release): pulling ${{ steps.create-release.outputs.branch_name }} into main' pr_body: ':crown: *An automated PR*' - pr_reviewer: 'bardisg,MoumitaM,saikumarrs' + pr_reviewer: 'MoumitaM,saikumarrs' diff --git a/.github/workflows/housekeeping.yaml b/.github/workflows/housekeeping.yaml index 9ccb84ad1..71f78b185 100644 --- a/.github/workflows/housekeeping.yaml +++ b/.github/workflows/housekeeping.yaml @@ -1,13 +1,13 @@ -name: Handle stale PRs +name: Handle Stale PRs and Branches on: schedule: - - cron: '42 1 * * *' + - cron: '1 0 * * *' # every day at 00:01 jobs: prs: - name: Clean up stale prs - runs-on: ubuntu-latest + name: Clean up stale PRs + runs-on: [self-hosted, Linux, X64] permissions: issues: write @@ -18,17 +18,18 @@ jobs: with: repo-token: ${{ github.token }} operations-per-run: 200 - stale-pr-message: 'This PR is considered to be stale. It has been open 20 days with no further activity thus it is going to be closed in 10 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.' + stale-pr-message: 'Hello! This PR has been open for 20 days without any activity. Therefore, it''s considered as stale and is scheduled to be closed in 10 days. If you''re still working on this, please remove the ''Stale'' label or add a comment to keep it open. Thanks for your contribution!' days-before-pr-stale: 20 days-before-pr-close: 10 stale-pr-label: 'Stale' branches: - name: Cleanup old branches - runs-on: ubuntu-latest + name: Clean up stale branches + runs-on: [self-hosted, Linux, X64] steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Run delete-old-branches-action uses: beatlabs/delete-old-branches-action@v0.0.10 with: @@ -36,5 +37,5 @@ jobs: date: '2 months ago' dry_run: false delete_tags: false - extra_protected_branch_regex: ^(main|master|develop|production|production-staging|v1-staging|v1-production|legacy-develop|legacy-master)$ + extra_protected_branch_regex: ^(main|develop|production|production-staging|v1-staging|v1-production)$ exclude_open_pr_branches: true diff --git a/.github/workflows/publish-new-release-v3.yml b/.github/workflows/publish-new-release.yml similarity index 82% rename from .github/workflows/publish-new-release-v3.yml rename to .github/workflows/publish-new-release.yml index 8af895173..be8ee856c 100644 --- a/.github/workflows/publish-new-release-v3.yml +++ b/.github/workflows/publish-new-release.yml @@ -1,4 +1,4 @@ -name: Publish new github release v3 +name: Publish New Release to GitHub on: pull_request: @@ -12,16 +12,16 @@ env: jobs: release: - name: Publish new release v3 - runs-on: ubuntu-latest - if: (startsWith(github.event.pull_request.head.ref, 'v3-release/') || startsWith(github.event.pull_request.head.ref, 'v3-hotfix-release/')) && github.event.pull_request.merged == true # only merged pull requests must trigger this job + name: Publish new release + runs-on: [self-hosted, Linux, X64] + # only merged pull requests must trigger this job + if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/')) && github.event.pull_request.merged == true steps: - name: Extract version from branch name (for release branches) id: extract-version run: | BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - VERSION=${BRANCH_NAME#v3-} VERSION=${VERSION#hotfix-} VERSION=${VERSION#release/} @@ -51,7 +51,7 @@ jobs: git config user.name "GitHub actions" git config user.email noreply@github.com - - name: Create Monorepo Release Tag + - name: Create monorepo release tag id: create_monorepo_release run: | git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore(monorepo): release v${{ steps.extract-version.outputs.release_version }}" @@ -69,7 +69,7 @@ jobs: echo "last_monorepo_version=$(echo $LAST_VERSION)" >> $GITHUB_ENV echo "DATE=$(date)" >> $GITHUB_ENV - - name: Create GitHub Releases + - name: Create GitHub releases id: create_release env: HUSKY: 0 @@ -83,23 +83,23 @@ jobs: source_branch: 'main' destination_branch: 'develop' github_token: ${{ secrets.PAT }} - pr_title: 'chore(release): pulling main into develop post release v${{ steps.extract-version.outputs.release_version }}' + pr_title: 'chore(release): pull main into develop post release v${{ steps.extract-version.outputs.release_version }}' pr_body: ':crown: *An automated PR*' - pr_reviewer: 'bardisg,MoumitaM,saikumarrs' + pr_reviewer: 'MoumitaM,saikumarrs' - name: Delete hotfix release branch uses: koj-co/delete-merged-action@master - if: startsWith(github.event.pull_request.head.ref, 'v3-hotfix-release/') + if: startsWith(github.event.pull_request.head.ref, 'hotfix-release/') with: - branches: 'v3-hotfix-release/*' + branches: 'hotfix-release/*' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Delete release branch uses: koj-co/delete-merged-action@master - if: startsWith(github.event.pull_request.head.ref, 'v3-release/') + if: startsWith(github.event.pull_request.head.ref, 'release/') with: - branches: 'v3-release/*' + branches: 'release/*' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rollback-v3.yml b/.github/workflows/rollback-v3.yml deleted file mode 100644 index ff7fc5bb1..000000000 --- a/.github/workflows/rollback-v3.yml +++ /dev/null @@ -1,190 +0,0 @@ -name: Rollback v3 - -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 - -env: - NODE_OPTIONS: "--no-warnings" - -jobs: - deploy-tag: - name: Rollback v3 - runs-on: [self-hosted, Linux, X64] - if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') - - steps: - - name: Install AWS cli - uses: unfor19/install-aws-cli-action@master - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - 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 - uses: actions/checkout@v4 - - - name: Get new version number - run: | - current_version_v1=$(jq -r .version packages/analytics-v1.1/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_VALUE=$current_version" >> $GITHUB_ENV - echo "DATE=$(date)" >> $GITHUB_ENV - - - name: Setup Node - uses: actions/setup-node@v4 - 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: Build release artifacts - env: - 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 build:browser - npm run build:browser:modern - - - name: Sync file to S3 adobe-analytics-js assets folder - run: | - aws s3 cp assets/integrations/AdobeAnalytics/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/adobe-analytics-js --recursive --cache-control max-age=3600 - aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/adobe-analytics-js*" - - - name: Sync files to S3 v1.1 folder - run: | - aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/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 }}/v1.1/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 }}/v1.1/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/rudder-analytics.min.js --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/rudder-analytics.min.js.map --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v1.1/modern/list_integration_sdks.html --cache-control max-age=3600 - AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/v1.1*" - - - name: Sync files to S3 v1.1 versioned folder - run: | - aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/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 }}/${{ env.CURRENT_VERSION_V1_VALUE }}/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 }}/${{ env.CURRENT_VERSION_V1_VALUE }}/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/rudder-analytics.min.js --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/rudder-analytics.min.js.map --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_V1_VALUE }}/modern/list_integration_sdks.html --cache-control max-age=3600 - AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ env.CURRENT_VERSION_V1_VALUE }}*" - - - name: Sync files to S3 v3 folder - run: | - aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v3/legacy/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/v3/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 }}/v3/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 }}/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_PROD_S3_BUCKET_NAME }}/v3/modern/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 "/v3/*" - - - name: Sync files to S3 v3 versioned folder - run: | - aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_VALUE }}/legacy/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/${{ env.CURRENT_VERSION_VALUE }}/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 }}/${{ env.CURRENT_VERSION_VALUE }}/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 }}/${{ env.CURRENT_VERSION_VALUE }}/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 }}/${{ env.CURRENT_VERSION_VALUE }}/modern/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 "/${{ env.CURRENT_VERSION_VALUE }}/*" - - - name: Sync files to S3 latest - run: | - aws s3 cp packages/analytics-v1.1/dist/cdn/legacy/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/latest/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/rudder-analytics.min.js --cache-control max-age=3600 - aws s3 cp packages/analytics-v1.1/dist/cdn/modern/rudder-analytics.min.js.map s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/rudder-analytics.min.js.map --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/dist/cdn/modern/js-integrations/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/js-integrations/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js-integrations/public/list_integration_sdks.html s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/modern/list_integration_sdks.html --cache-control max-age=3600 - aws s3 cp packages/analytics-js/dist/cdn/legacy/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/v3/legacy/ --recursive --cache-control max-age=3600 - aws s3 cp packages/analytics-js/dist/cdn/modern/iife/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/latest/v3/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 }}/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_PROD_S3_BUCKET_NAME }}/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_PROD_S3_BUCKET_NAME }}/latest/v3/modern/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 "/latest*" - - - name: Send message to Slack channel v3 - id: slack - uses: slackapi/slack-github-action@v1.25.0 - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - PROJECT_NAME: 'JS SDK v3 Browser Package Rollback' - CDN_URL: 'https://cdn.rudderlabs.com/v3/modern/rsa.min.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.CDN_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}" - } - } - ] - } - - - name: Send message to Slack channel - id: slackv1 - uses: slackapi/slack-github-action@v1.25.0 - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - PROJECT_NAME: 'JS SDK v1.1 Browser Package Rollback' - CDN_URL: 'https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.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.CDN_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}" - } - } - ] - } diff --git a/.github/workflows/rollback.yml b/.github/workflows/rollback.yml new file mode 100644 index 000000000..2817eb870 --- /dev/null +++ b/.github/workflows/rollback.yml @@ -0,0 +1,27 @@ +name: Rollback Production Deployment + +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 + +env: + NODE_OPTIONS: "--no-warnings" + +jobs: + deploy-tag: + name: Rollback production deployment + if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') + uses: ./.github/workflows/deploy-prod.yml + with: + action_type: ' Rollback' + secrets: + AWS_PROD_ACCOUNT_ID: ${{ secrets.AWS_PROD_ACCOUNT_ID }} + AWS_PROD_S3_SYNC_ROLE: ${{ secrets.AWS_PROD_S3_SYNC_ROLE }} + AWS_PROD_S3_BUCKET_NAME: ${{ secrets.AWS_PROD_S3_BUCKET_NAME }} + AWS_PROD_CF_DISTRIBUTION_ID: ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} + RS_PROD_BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }} + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} diff --git a/.github/workflows/build-and-quality-checks-v3.yml b/.github/workflows/security-code-quality-and-bundle-size-checks.yml similarity index 69% rename from .github/workflows/build-and-quality-checks-v3.yml rename to .github/workflows/security-code-quality-and-bundle-size-checks.yml index 7816f63c9..31f554417 100644 --- a/.github/workflows/build-and-quality-checks-v3.yml +++ b/.github/workflows/security-code-quality-and-bundle-size-checks.yml @@ -1,18 +1,17 @@ -name: Build & Code Quality Checks v3 +name: Security, Code Quality and Bundle Size Checks on: pull_request: - branches: ['develop', 'main', 'v3-hotfix/*'] + branches: ['develop', 'main', 'hotfix/*'] types: ['opened', 'reopened', 'synchronize'] env: NODE_OPTIONS: "--no-warnings" jobs: - build: - name: Build & Code Quality Checks v3 + bundle-size-checks: + name: Bundle size checks runs-on: [self-hosted, Linux, X64] - steps: - name: Checkout uses: actions/checkout@v4 @@ -23,21 +22,6 @@ jobs: node-version-file: '.nvmrc' cache: 'npm' - - name: Install dependencies - env: - HUSKY: 0 - run: | - npm run setup:ci - - - name: Execute security checks - run: | - npm run check:security - - - name: Execute quality checks - run: | - npm run check:circular - npm run check:duplicates - - name: Execute bundle size checks uses: rudderlabs/github-action-check-size-limit@v2.9.0 env: @@ -49,3 +33,32 @@ jobs: clean_script: clean script: npm run check:size:json:ci --silent -- --output-style=static --silent=true --exclude=@rudderstack/analytics-js-sanity-suite,@rudderstack/analytics-js-loading-scripts is_monorepo: true + + security-code-quality-checks: + name: Security and code quality checks + runs-on: [self-hosted, Linux, X64] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + env: + HUSKY: 0 + run: | + npm run setup:ci + + - name: Execute code quality checks + run: | + npm run check:circular + npm run check:duplicates + + - name: Execute security checks + run: | + npm run check:security diff --git a/.github/workflows/test-v3.yml b/.github/workflows/unit-tests-and-lint.yml similarity index 91% rename from .github/workflows/test-v3.yml rename to .github/workflows/unit-tests-and-lint.yml index 40fd5e080..cf6e657f8 100644 --- a/.github/workflows/test-v3.yml +++ b/.github/workflows/unit-tests-and-lint.yml @@ -1,19 +1,19 @@ -name: 'Unit Tests, Coverage & Sonar v3' +name: Unit Tests and Lint on: workflow_dispatch: push: branches: ['main', 'develop'] pull_request: - branches: ['main', 'develop', 'v3-hotfix/*'] + branches: ['main', 'develop', 'hotfix/*'] types: ['opened', 'reopened', 'synchronize'] env: NODE_OPTIONS: "--no-warnings" jobs: - build: - name: 'Unit Tests, Coverage & Sonar v3' + test: + name: Unit Tests and Lint runs-on: [self-hosted, Linux, X64] steps: @@ -38,6 +38,13 @@ jobs: run: | npm run test:ci + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: ./packages/analytics-js/reports/coverage/clover.xml,./packages/analytics-js-common/reports/coverage/clover.xml,./packages/analytics-js-integrations/reports/coverage/clover.xml,./packages/analytics-js-plugins/reports/coverage/clover.xml,./packages/analytics-js-service-worker/reports/coverage/clover.xml,./packages/analytics-v1.1/reports/coverage/clover.xml + - name: Execute linting check run: | npm run check:lint:ci @@ -51,10 +58,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: ./packages/analytics-js/reports/coverage/clover.xml,./packages/analytics-js-common/reports/coverage/clover.xml,./packages/analytics-js-integrations/reports/coverage/clover.xml,./packages/analytics-js-plugins/reports/coverage/clover.xml,./packages/analytics-js-service-worker/reports/coverage/clover.xml,./packages/analytics-v1.1/reports/coverage/clover.xml diff --git a/.nvmrc b/.nvmrc index 8b0beab16..2dbbe00e6 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20.11.0 +20.11.1 diff --git a/CODEOWNERS b/CODEOWNERS index 34bff5c4d..99001adf7 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,2 @@ -* @saikumarrs @MoumitaM @bardisg +* @saikumarrs @MoumitaM /packages/analytics-js-integrations/ @ItsSudip @shrouti1507 @sandeepdsvs @koladilip @mihir-4116