-
Notifications
You must be signed in to change notification settings - Fork 237
86 lines (77 loc) · 3.69 KB
/
deploy-customui-demo.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
name: Update, Build and Deploy custom ui example
on:
release:
types: [published]
push:
branches: [master]
jobs:
custom-ui-react-app:
strategy:
matrix:
node: ["20.x"]
os: [ubuntu-latest]
demo: [custom-ui-react-app]
runs-on: ${{ matrix.os }}
steps:
- name: Check out Git repository
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
uses: actions/checkout@v3
- name: Set up node
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Build ${{ matrix.demo }} demo
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
run: |
npm i -g npm-check-updates
cd demo/${{ matrix.demo }}
ncu -u --target=minor
ncu -u "/^@web3auth.*$/"
npm install
npm run build
- name: Commit Changes
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
push: origin HEAD:master
author_name: Torus Bot
author_email: [email protected]
default_author: user_info
# The way the action should handle pathspec errors from the add and remove commands. Three options are available:
# - ignore -> errors will be logged but the step won't fail
# - exitImmediately -> the action will stop right away, and the step will fail
# - exitAtEnd -> the action will go on, every pathspec error will be logged at the end, the step will fail.
# Default: ignore
pathspec_error_handling:
exitImmediately
# Set the credentials from repository settings/secrets
- name: Configure AWS credentials
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION_US }}
# Copy the files from build folder to the S3 bucket
# Upload to S3
- name: sync s3
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
uses: jakejarvis/s3-sync-action@master
env:
SOURCE_DIR: "./demo/custom-ui-react-app/build"
AWS_REGION: "us-east-1"
AWS_S3_BUCKET: "core-demo.web3auth.io"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Invalidate Cloudfront (this action)
- name: invalidate
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]')))
uses: chaitanyapotti/cloudfront-update-distribution@v2
with:
cloudfront-distribution-id: ${{ secrets.AWS_CLOUDFRONT_CORE_DEMO_DISTRIBUTION_ID }}
cloudfront-invalidation-path: "/*"
cloudfront-invalidation-required: true
cloudfront-wait-for-service-update: false