-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.95 KB
/
deploy_prod.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
name: Deploy
on:
pull_request:
branches:
- dev
push:
branches:
- deploytest
env:
S3_BUCKET_NAME: itracker-front
CODE_DEPLOY_APPLICATION_NAME: itracker
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: itracker-front-prod
jobs:
build:
environment: develop
runs-on: ubuntu-latest
steps:
- name: Checkout source code.
uses: actions/checkout@v3
- name: Check Node v
run: node -v
- name: Generate Environment Variables File
run: |
echo "NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL }}" >> .env.local
echo "NEXT_PUBLIC_GA_ID=${{ secrets.NEXT_PUBLIC_GA_ID }}" >> .env.local
- name: Cache yarn
uses: actions/cache@v3
id: yarn-cache
with:
path: |
~/.cache/yarn
**/node_modules
key: yarn-cache-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-cache-${{ runner.os }}-
- name: Install Dependencies
run: yarn install
- name: Build
run: yarn build
- name: zip create
run: zip -qq -r ./itracker-build.zip .
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./itracker-build.zip s3://$S3_BUCKET_NAME/itracker-build.zip
- name: Deploy For Development
run: |
aws deploy create-deployment \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=itracker-build.zip,bundleType=zip