-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (59 loc) · 2.13 KB
/
main.yml
File metadata and controls
71 lines (59 loc) · 2.13 KB
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: release
on:
pull_request:
branches:
- release
jobs:
build:
runs-on: ubuntu-18.04
strategy:
matrix:
node-version: [16.13.0]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: node setup
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cachce node_modules
uses: actions/cache@v2
id: node-cache
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install node_modules
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Generate Environment Variable Files for Production
run: |
pwd
cd /home/runner/work/cupicks-fe/cupicks-fe
touch .env
echo VITE_SERVER_URL=${{secrets.VITE_SERVER_URL}} >> .env
- name: Build
run: |
cd /home/runner/work/cupicks-fe/cupicks-fe
npm run build
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
run: |
aws s3 cp \
--recursive \
--region ap-northeast-2 \
dist s3://cupick.co
- name: Invalidate CloudFront Cache
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
run: aws cloudfront create-invalidation --distribution-id ${{secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/*"