-
Notifications
You must be signed in to change notification settings - Fork 18
62 lines (51 loc) · 1.84 KB
/
integration-deploy.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
name: CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
quality:
runs-on: ubuntu-latest
strategy:
matrix:
command: ['test', 'lint', 'tsc']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.8
cache: 'yarn'
- name: install dependencies
run: yarn --frozen-lockfile
- name: Run tests and lint
uses: borales/actions-yarn@v4
with:
cmd: ${{ matrix.command }}
build:
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
AWS_S3_BUCKET_NAME: ${{ github.ref == 'refs/heads/main' && secrets.AWS_S3_BUCKET_NAME_PRD || secrets.AWS_S3_BUCKET_NAME_HOM }}
AWS_DISTRIBUTION_ID: ${{ github.ref == 'refs/heads/main' && secrets.AWS_DISTRIBUTION_ID_PRD || secrets.AWS_DISTRIBUTION_ID_HOM }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 20.8
- uses: shinyinc/[email protected]
- name: install dependencies
run: yarn --frozen-lockfile
- name: build projects
run: yarn ${{ github.ref == 'refs/heads/main' && 'build' || 'build:staging' }}
- name: sync static with s3
run: aws s3 sync apps/static s3://$AWS_S3_BUCKET_NAME
- name: sync react with s3
run: aws s3 sync apps/react/dist s3://$AWS_S3_BUCKET_NAME/react
- name: sync container with s3
run: aws s3 sync apps/container/dist s3://$AWS_S3_BUCKET_NAME/app
- name: invalidate cloudfront cache
run: aws cloudfront create-invalidation --distribution-id $AWS_DISTRIBUTION_ID --paths "/*"