Merge pull request #833 from henry-deriv/henry/livechat-feature-toggle #25
Workflow file for this run
This file contains 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
name: DSmartTrader Production Release | |
on: | |
push: | |
tags: | |
- production_* | |
jobs: | |
build_and_test: | |
name: Build and Test | |
environment: Production | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_TYPE: Production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Setup Node | |
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
uses: "./.github/actions/npm_install" | |
- name: Build | |
uses: "./.github/actions/build" | |
with: | |
target: production | |
RUDDERSTACK_KEY: ${{ vars.RUDDERSTACK_KEY }} | |
GROWTHBOOK_CLIENT_KEY: ${{ vars.GROWTHBOOK_CLIENT_KEY }} | |
REMOTE_CONFIG_URL: ${{ vars.REMOTE_CONFIG_URL }} | |
- name: Versioning | |
uses: "./.github/actions/versioning" | |
with: | |
target_branch: production | |
- name: "Run Tests" | |
run: npm run test | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 | |
with: | |
name: dist | |
path: dist | |
publish_cloudflare_production: | |
name: Publish to Cloudflare Production | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_TYPE: Production | |
needs: [build_and_test] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Setup Node | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 | |
with: | |
node-version: 20 | |
- name: Download Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: dist | |
path: dist | |
- name: Publish to Cloudflare | |
uses: "./.github/actions/publish_to_pages_production" | |
with: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
- name: Upload to vercel | |
id: deploy_vercel | |
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master' | |
with: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }} | |
ENVIRONMENT: Production | |
VERCEL_SCOPE: deriv | |
ALIAS_DOMAIN_URL: 'smarttrader-dr.binary.sx' | |
- name: Send Slack Notification on Docker Publish and Kubernetes Deployment Failure | |
if: ${{ steps.deploy_vercel.outcome != 'success' }} | |
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master" | |
with: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
MESSAGE: "$RELEASE_TYPE Vercel Deployment for smarttrader.deriv.com with version ${{ needs.build_and_test.outputs.RELEASE_VERSION }} has Failed" | |
notify_on_slack: | |
name: Notify on Slack | |
if: always() | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_TYPE: Production | |
APP_NAME: smarttrader-deriv-app | |
needs: [publish_cloudflare_production, build_and_test] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Setup Node | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 | |
with: | |
node-version: 20 | |
- name: Conclusion | |
uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 | |
- name: Download Artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: dist | |
path: dist | |
- name: Grab Version Name | |
id: extract_version | |
run: echo "RELEASE_VERSION=$(cat dist/version.txt)" >> $GITHUB_ENV | |
- name: Create Slack Message | |
id: create_slack_message | |
run: | | |
if [ $WORKFLOW_CONCLUSION == "success" ]; then | |
echo "MESSAGE=$RELEASE_TYPE Release succeeded for $APP_NAME with version ${{ needs.build_and_test.outputs.RELEASE_VERSION }}" >> $GITHUB_OUTPUT | |
else | |
echo "MESSAGE=$RELEASE_TYPE Release failed for $APP_NAME with version ${{ needs.build_and_test.outputs.RELEASE_VERSION }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Send Slack Notification | |
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master" | |
with: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
MESSAGE: ${{ steps.create_slack_message.outputs.MESSAGE }} |