-
Notifications
You must be signed in to change notification settings - Fork 29
73 lines (62 loc) · 2.52 KB
/
deploy-dev.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
name: Deploy
on:
push:
branches:
- main
paths:
- "packages/**"
jobs:
deploy-wallet-ui:
name: Deploy Wallet UI (Dev)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Get Yarn cache directory
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn cache dir)"
id: yarn-cache-dir
- name: Get Yarn version
run: echo "::set-output name=YARN_VERSION::$(yarn --version)"
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Cache froxe lockfile
run: yarn install --no-immutable && yarn setup
- name: Clean yarn cache
run: yarn clean
- name: Build wallet-ui workspace
run: |
VERSION=$(node -p "require('./packages/starknet-snap/package.json').version")
HASH=$(git rev-parse --short HEAD)
DATE=$(date +%Y%m%d)
REACT_APP_SNAP_VERSION=${VERSION}-dev-${HASH}-${DATE} yarn workspace wallet-ui build
- name: Deploy to Dev
run: |
aws s3 sync ./packages/wallet-ui/build s3://dev.snaps.consensys.net/starknet
aws s3 sync ./packages/wallet-ui/build s3://dev.snaps.consensys.io/starknet
- name: invalid aws cloudfront cache
env:
AWS_CLOUDFRONT_DISTRIBUTIONS_ID: ${{ vars.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}
run: |
echo "Distribution ID : $AWS_CLOUDFRONT_DISTRIBUTIONS_ID"
for process in $(echo $AWS_CLOUDFRONT_DISTRIBUTIONS_ID | sed "s/,/ /g")
do
echo "Processing Distribution ID : $process"
id="$(aws cloudfront create-invalidation --distribution-id $process --paths "/starknet/*" | grep Id | awk -F'"' '{ print $4}')"
echo "Waiting for invalidation $id"
aws cloudfront wait invalidation-completed --id $id --distribution-id $process
echo "Invalidation $id completed"
done