generated from pasly0920/webpack-boilerplate-react
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (46 loc) · 1.62 KB
/
dev-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
name: dev-deploy-actions
on:
push:
branches: [develop]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup Node Version #avoid node verison error
uses: actions/setup-node@v3
with:
node-version: 16.15.1
cache: yarn
- name: Setup Python for AWS CLI
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install AWS CLI
run: pip3 install awscli --upgrade --user
- 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: ${{ secrets.AWS_REGION }}
mask-aws-account-id: true
- name: Install dependencies
run: yarn
- name: Create env file
run: |
touch .env
echo BASE_API_URL=${{secrets.BASE_API_URL}} >> .env
echo FROALA_LICENSE_KEY=${{secrets.FROALA_LICENSE_KEY}} >> .env
cat .env
- name: Build
run: yarn build:prod
- name: Deploy to S3
run: aws s3 sync ./dist s3://dev.edu-vivid.com/ --acl bucket-owner-full-control
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{secrets.AWS_DISTRIBUTION_ID}} --paths "/*"