Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Merge pull request #470 from farabi-deriv/fix--release-production-yml… #16

Merge pull request #470 from farabi-deriv/fix--release-production-yml…

Merge pull request #470 from farabi-deriv/fix--release-production-yml… #16

name: Binary Bot Production Workflow
on:
push:
tags:
- production_*
jobs:
release_production:
name: Build, Test and Deploy to Cloudflare Pages
environment: Production
runs-on: ubuntu-latest
outputs:
RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: "./.github/actions/setup_node"
with:
node-version: "18.x"
- name: Install Dependencies
uses: "./.github/actions/npm_install_from_cache"
- name: Build
uses: "./.github/actions/build"
with:
NODE_ENV: production
GD_API_KEY: ${{ secrets.GD_API_KEY }}
GD_APP_ID: ${{ secrets.GD_APP_ID }}
GD_CLIENT_ID: ${{ secrets.GD_CLIENT_ID }}
TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }}
DATADOG_CLIENT_LOGS_TOKEN: ${{ secrets.DATADOG_CLIENT_LOGS_TOKEN }}
DATADOG_LOGS_SESSION_SAMPLE_RATE: ${{ secrets.DATADOG_LOGS_SESSION_SAMPLE_RATE }}
REF_NAME: ${{ github.ref_name }}
- name: Test
uses: "./.github/actions/test"
- name: Versioning
uses: "./.github/actions/versioning"
with:
RELEASE_TYPE: production
- name: Extract version
id: extract_version
run: echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Deploy to Cloudflare Pages
uses: "./.github/actions/publish_to_cf_pages_production"
with:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
publish_to_vercel:
runs-on: ubuntu-latest
environment: Production
needs: [release_production]
steps:
- name: Upload to vercel
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
id: dr_action
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: 'bot-dr.binary.sx'
- name: Send Slack Notification on Vercel Publish failure
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master"
if: steps.dr_action.conclusion == 'failure'
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "Vercel Publish failed for bot.deriv.com with version ${{ needs.release_production.outputs.RELEASE_VERSION }}"
send_slack_notification:
if: always()
needs: [release_production]
environment: Production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Conclusion
uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5
- name: Send Slack Notification
uses: "./.github/actions/send_slack_notifications"
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ env.WORKFLOW_CONCLUSION }}
release_type: Production
version: ${{ needs.release_production.outputs.RELEASE_VERSION }}
app_url: https://bot.deriv.com/