Skip to content

Commit

Permalink
chore: refactor workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Mar 12, 2024
1 parent 43f591e commit 0db4de2
Show file tree
Hide file tree
Showing 18 changed files with 278 additions and 429 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/check_pr_title.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create new hotfix branch v3
name: Create a new hotfix branch

on:
workflow_dispatch:
Expand All @@ -9,13 +9,13 @@ 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
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'v3-hotfix/${{ github.event.inputs.hotfix_name }}'
branch: 'hotfix/${{ github.event.inputs.hotfix_name }}'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy BETA/BugBash Feature v3
name: Deploy BETA/BugBash Feature

on:
workflow_dispatch:
Expand All @@ -12,14 +12,20 @@ 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')

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: Extract feature name from branch
id: extract_branch
shell: bash
Expand All @@ -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

Expand Down Expand Up @@ -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 }}/*"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to DEV v3
name: Deploy to Development Environment

on:
workflow_dispatch:
Expand All @@ -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 }}
Expand Down Expand Up @@ -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*"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to NPM v3
name: Deploy to NPM

on:
workflow_dispatch:
Expand All @@ -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:
Expand Down Expand Up @@ -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/[email protected]
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: |
Expand All @@ -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/[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'
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: |
Expand All @@ -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 }}"
}
}
]
Expand Down
Loading

0 comments on commit 0db4de2

Please sign in to comment.