forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (118 loc) · 5 KB
/
release_production.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Deriv App Production Workflow
on:
push:
tags:
- production_*
env:
RELEASE_TYPE: Production
jobs:
build_test_and_publish:
name: Build, Test and Publish to Cloudflare Pages Production
environment: Production
runs-on: Runner_16cores_Deriv-app
outputs:
RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Node
uses: "./.github/actions/setup_node"
- name: Install Dependencies
uses: "./.github/actions/npm_install_from_cache"
- name: Download Remote Config Backup File
uses: ./.github/actions/download_remote_config_backup
with:
REMOTE_CONFIG_URL: ${{ vars.REMOTE_CONFIG_URL }}
- name: Build
uses: "./.github/actions/build"
with:
NODE_ENV: production
DATADOG_APPLICATION_ID: ${{ vars.DATADOG_APPLICATION_ID }}
IS_GROWTHBOOK_ENABLED: ${{ vars.IS_GROWTHBOOK_ENABLED }}
DATADOG_CLIENT_TOKEN: ${{ vars.DATADOG_CLIENT_TOKEN }}
DATADOG_CLIENT_TOKEN_LOGS: ${{ vars.DATADOG_CLIENT_TOKEN_LOGS }}
DATADOG_SESSION_REPLAY_SAMPLE_RATE: ${{ vars.DATADOG_SESSION_REPLAY_SAMPLE_RATE }}
DATADOG_SESSION_SAMPLE_RATE: ${{ vars.DATADOG_SESSION_SAMPLE_RATE }}
DATADOG_SESSION_SAMPLE_RATE_LOGS: ${{ vars.DATADOG_SESSION_SAMPLE_RATE_LOGS }}
GD_API_KEY: ${{ secrets.GD_API_KEY }}
GD_APP_ID: ${{ secrets.GD_APP_ID }}
GD_CLIENT_ID: ${{ secrets.GD_CLIENT_ID }}
RUDDERSTACK_KEY: ${{ vars.RUDDERSTACK_KEY }}
GROWTHBOOK_CLIENT_KEY: ${{ vars.GROWTHBOOK_CLIENT_KEY }}
GROWTHBOOK_DECRYPTION_KEY: ${{ vars.GROWTHBOOK_DECRYPTION_KEY }}
REF_NAME: ${{ github.ref_name }}
REMOTE_CONFIG_URL: ${{ vars.REMOTE_CONFIG_URL }}
TRUSTPILOT_API_KEY: ${{ secrets.TRUSTPILOT_API_KEY }}
- name: Run tests
run: npm test
- name: Versioning
uses: "./.github/actions/versioning"
with:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
- name: Extract version
id: extract_version
run: echo "RELEASE_VERSION=${version}" >> $GITHUB_OUTPUT
- name: Publish to Cloudflare Pages Production
uses: "./.github/actions/publish_to_pages_production"
with:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Upload Build Artifact
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8
with:
name: build
path: packages/core/dist
retention-days: 1
send_slack_failure:
name: Send Release Slack notification failure
runs-on: Runner_8cores_Deriv-app
environment: Production
if: failure()
needs: [build_test_and_publish]
steps:
- name: Send Slack Notification
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master"
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "${{ env.RELEASE_TYPE }} Release failed for app.deriv.com with version ${{ needs.build_test_and_publish.outputs.RELEASE_VERSION }}"
send_slack_success:
name: Send Release Slack notification success
runs-on: Runner_8cores_Deriv-app
environment: Production
if: success()
needs: [build_test_and_publish]
steps:
- name: Send Slack Notification
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master"
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "${{ env.RELEASE_TYPE }} Release succeeded for app.deriv.com with version ${{ needs.build_test_and_publish.outputs.RELEASE_VERSION }}"
build_and_publish_to_DR_solution:
name: Build Docker image and push to Docker hub and K8S
runs-on: Runner_8cores_Deriv-app
environment: Production
needs: [build_test_and_publish]
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Download Build Artifact
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
name: build
path: packages/core/dist
- name: Upload to vercel
id: vercel-upload
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: 'app-dr.binary.sx'
- name: Send DR Slack Notification
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master"
if: ${{ steps.vercel-upload.outcome != 'success' }}
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: Disaster Recovery Release to vercel failed for app.deriv.com with version ${{ needs.build_test_and_publish.outputs.RELEASE_VERSION }}