-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (160 loc) · 5.77 KB
/
deploy-stage.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: 'Deploy to staging'
on:
release:
types:
- created
env:
NODE_VERSION: 18.16.0
ENV: stage
AWS_EC2_METADATA_DISABLED: true
jobs:
frontend_deploy_stage:
runs-on: ubuntu-20.04
timeout-minutes: 15
env:
BUCKET_NAME: www-staging-aldnr.rumblefish.dev.evm-debugger
PREFIX: evm-debugger
if: |
startsWith(github.ref, 'refs/tags/@evm-debuger/frontend') &&
contains(github.ref, '-alpha.')
permissions:
id-token: write
contents: read
steps:
- name: 'Checkout'
uses: actions/[email protected]
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://npm.pkg.github.com'
scope: "@rumblefishdev"
- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
with:
path: |
**/node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('packages/*/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install dependencies
run: |
npm i
node_modules/.bin/lerna bootstrap
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check if @rumblefishdev/ui installed
run: |
if [[ ! -d packages/frontend/node_modules/@rumblefishdev/ui ]]; then
echo "Error: @rumblefishdev/ui not installed"
exit 1
fi
- name: 'Build'
run: |
npm run types:build
npm run analyzer:build
npm run frontend:build:stage
env:
REACT_APP_STRAPI_AUTH_TOKEN: ${{ secrets.STRAPI_AUTH_TOKEN }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-frontend-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}
- name: 'Deploy'
run: |
aws s3 sync packages/frontend/build s3://${BUCKET_NAME}/${PREFIX} --delete --exact-timestamps
- name: Assume role on main AWS account
run: |
role_name=$(aws cloudformation describe-stacks --stack-name evm-transaction-trace-stage | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "CloudfrontInvalidationRoleArn"))[0].ParameterValue')
output=$(aws sts assume-role --role-arn "$role_name" --role-session-name github-stage-frontend-Session)
echo "AWS_ACCESS_KEY_ID=$(echo $output | jq -r '.Credentials.AccessKeyId')" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=$(echo $output | jq -r '.Credentials.SecretAccessKey')" >> $GITHUB_ENV
echo "AWS_SESSION_TOKEN=$(echo $output | jq -r '.Credentials.SessionToken')" >> $GITHUB_ENV
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths "/${PREFIX}/*"
env:
DISTRIBUTION_ID: E1TRXMZGQSBIBH
transaction_trace_deploy_stage:
runs-on: ubuntu-20.04
if: |
startsWith(github.ref, 'refs/tags/@evm-debuger/transaction-trace') &&
contains(github.ref, '-alpha.')
permissions:
id-token: write
contents: read
steps:
- name: 'Checkout'
uses: actions/[email protected]
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
with:
path: |
**/node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('packages/*/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install dependencies
run: |
npm i
npm install jq.node -g
node_modules/.bin/lerna bootstrap
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build
run: |
npm run types:build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-transaction-trace-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}
- name: Deploy stack
working-directory: ./packages/infra
run: |
make stage-deploy
srcmap_compiler_deploy_stage:
runs-on: ubuntu-20.04
if: |
startsWith(github.ref, 'refs/tags/@evm-debuger/srcmap-compiler') &&
contains(github.ref, '-alpha.')
permissions:
id-token: write
contents: read
steps:
- name: 'Checkout'
uses: actions/[email protected]
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
with:
path: |
**/node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('packages/*/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install dependencies
run: |
npm i
npm install jq.node -g
node_modules/.bin/lerna bootstrap
- name: Build
run: |
npm run types:build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-srcmap-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}
- name: Deploy stack
working-directory: ./packages/infra/compiler
run: |
make stage-deploy-all