-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (118 loc) · 5.83 KB
/
deploy-prod.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Deploy to alphaday (production)
on:
workflow_dispatch:
env:
ENVIRONMENT: production
VITE_LOGLEVEL: 2
VITE_API_BASE_URL: https://api.alphaday.com/
VITE_X_APP_ID: sBnL0RkWkM
VITE_X_APP_SECRET: 21gPAwU3uOUisMJJFJjaotbDxCmvCHKMh76Xlvb8XK2RkkvZHhtSfcUfoz6QiFx8zhZf31vxvKAFD7pkdmbjHiKwoVuS2iDOLjvC
VITE_ZAPPER_BASE_URL: https://api.zapper.fi/v1/
VITE_ZAPPER_BASE_URL_V2: https://api.zapper.fi/v2/
VITE_COINGECKO_BASE_URL: https://api.coingecko.com/api/v3/
VITE_DEFIPULSE_BASE_URL: https://data-api.defipulse.com/api/v1/
VITE_ETHERSCAN_BASE_URL: https://api.etherscan.io/api
VITE_ULTRA_SOUND_MONEY_BASE_URL: https://api.ultrasound.money/
VITE_ALPHADAY_IPFS_GATEWAY: https://alphaday.infura-ipfs.io/ipfs/
VITE_SWAP_FEE: 10
VITE_SWAP_FEE_ADDRESS: "0xeb2eCdDF7db14D4Ebca0848F2a879162eb8A43F1"
VITE_GA_MEASUREMENT_ID: G-8G37CL2HMF
VITE_FIRE_PROJECT_ID: alphaday
VITE_FIRE_MEASUREMENT_ID: G-D024QSX252
# alphaday.com site id
VITE_HOTJAR_SITE_ID: 3070399
VITE_HOTJAR_SNIPPET_VERSION: 6
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check if necessary ENV variables are set
run: |
if [ -z "$VITE_OAUTH_ID_GOOGLE" ]; then
echo "ERROR: missing google oauth client id"
exit 1
fi
if [ -z "$VITE_OAUTH_ID_APPLE" ]; then
echo "ERROR: missing apple oauth client id"
exit 1
fi
env:
VITE_OAUTH_ID_GOOGLE: ${{ secrets.PROD__REACT_APP_OAUTH_ID_GOOGLE }}
VITE_OAUTH_ID_APPLE: ${{ secrets.PROD__FRONTEND__OAUTH_ID_APPLE }}
- name: Set tag ENV
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/setup-node@v3
with:
node-version: "20.11.0"
cache: "yarn"
cache-dependency-path: |
yarn.lock
- name: yarn install
run: yarn --ignore-engines
- name: build
run: yarn build:deploy
env:
VITE_ENVIRONMENT: ${{ env.ENVIRONMENT }}
VITE_STORAGE_BUCKET_URL: ${{ secrets.PROD__FRONTEND__STORAGE_BUCKET_URL }}
VITE_DEFIPULSE_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_DEFIPULSE }}
VITE_ETHERSCAN_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_ETHERSCAN }}
VITE_ETHPLORER_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_ETHPLORER }}
VITE_ZAPPER_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_ZAPPER }}
VITE_WALLET_CONNECT_PROJECT_ID: ${{ secrets.PROD__REACT_APP_WALLET_CONNECT_PROJECT_ID }}
VITE_FIRE_API_KEY: ${{ secrets.PROD__REACT_APP_FIRE_API_KEY }}
VITE_FIRE_AUTH_DOMAIN: ${{ secrets.PROD__REACT_APP_FIRE_AUTH_DOMAIN }}
VITE_FIRE_STORAGE_BUCKET: ${{ secrets.PROD__REACT_APP_FIRE_STORAGE_BUCKET }}
VITE_FIRE_MESSAGE_SENDER_ID: ${{ secrets.PROD__REACT_APP_FIRE_MESSAGE_SENDER_ID }}
VITE_FIRE_APP_ID: ${{ secrets.PROD__REACT_APP_FIRE_APP_ID }}
VITE_SENTRY_DSN: ${{ secrets.PROD__VITE_SENTRY_DSN }}
VITE_OAUTH_ID_GOOGLE: ${{ secrets.PROD__REACT_APP_OAUTH_ID_GOOGLE }}
VITE_OAUTH_ID_APPLE: ${{ secrets.PROD__FRONTEND__OAUTH_ID_APPLE }}
VITE_CLARITY_PROJECT_ID: ${{ secrets.PROD__FRONTEND__CLARITY_PROJECT_ID }}
VITE_CLARITY_MOBILE_PROJECT_ID: ${{ secrets.PROD__FRONTEND__CLARITY_MOBILE_PROJECT_ID }}
NODE_OPTIONS: "--max_old_space_size=4096"
# deploy: sync to s3 and invalidate cloudfront cache
- name: deploy
uses: kefranabg/s3-sync-action@master # https://github.com/kefranabg/s3-sync-action
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER__AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER__SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.PROD__FRONTEND__S3_BUCKET }}
DISTRIBUTION_ID: ${{ secrets.PROD__FRONTEND__DISTRIBUTION_ID }}
AWS_REGION: "eu-west-1" # optional: defaults to us-east-1
SOURCE_DIR: "dist"
set-cache-control:
uses: ./.github/workflows/set-cache-control.yml
needs: deploy
if: needs.deploy.result == 'success'
with:
ENVIRONMENT: alpha
VALUE: "no-cache"
secrets: inherit
# Get message VARs and Notify team through discord of deployment
notify:
name: Notify
runs-on: ubuntu-latest
needs: deploy
if: needs.deploy.result == 'success'
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Get Repo Name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: "Get Latest Tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
# Notify Discord
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK__OPS_CHANNEL }}
uses: "Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9"
with:
args: "${{ env.REPOSITORY_NAME }}-${{ steps.previoustag.outputs.tag }} (${{ github.event.pull_request.title }}) has been deployed on ${{ env.ENVIRONMENT }}."