-
Notifications
You must be signed in to change notification settings - Fork 7
80 lines (70 loc) · 3.14 KB
/
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Deploy
on:
push:
branches:
- develop
env:
PROJECT_NAME: orury-front
S3_BUCKET_NAME: orury-bepo-bucket
CODE_DEPLOY_APPLICATION_NAME: orury-code-deploy
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: orury-client-deploy-group
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: |
run: |
echo "NEXT_PUBLIC_MODE=$NEXT_PUBLIC_MODE" >> .env.development
echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" >> .env.development
echo "NEXT_PUBLIC_KAKAO_APP_KEY=$NEXT_PUBLIC_KAKAO_APP_KEY" >> .env.development
echo "KAKAO_CLIENT_ID=$KAKAO_CLIENT_ID" >> .env.development
echo "KAKAO_CLIENT_SECRET=$KAKAO_CLIENT_SECRET" >> .env.development
echo "NEXT_PUBLIC_API_MOCKING=$NEXT_PUBLIC_API_MOCKING" >> .env.development
echo "NEXTAUTH_SECRET=$NEXTAUTH_SECRET" >> .env.development
echo "NEXTAUTH_URL=$NEXTAUTH_URL" >> .env.development
echo "NEXT_PUBLIC_CRYPTO_KEY=$NEXT_PUBLIC_CRYPTO_KEY" >> .env.development
env:
NEXT_PUBLIC_MODE: ${{ secrets.NEXT_PUBLIC_MODE }}
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_KAKAO_APP_KEY: ${{ secrets.NEXT_PUBLIC_KAKAO_APP_KEY }}
KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }}
NEXT_PUBLIC_API_MOCKING: ${{ secrets.NEXT_PUBLIC_API_MOCKING }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
NEXT_PUBLIC_CRYPTO_KEY: <span class="math-inline">\{\{ secrets\.NEXT\_PUBLIC\_CRYPTO\_KEY \}\}
- name: Cache node modules
uses: actions/cache@v3
id: cache
with:
# node_modules라는 폴더를 검사하여
path: node_modules
# 아래 키값으로 cache가 돼있는지 확인합니다.
key: npm-packages-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
- name: Build
run: |
npm run build:dev
- name: zip create
run: |
zip -qq -r --symlinks ./orury-dev.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 ./orury-dev.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/orury-dev.zip
- name: Deploy For Development
run: aws deploy create-deployment --application-name $CODE_DEPLOY_APPLICATION_NAME --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name $CODE_DEPLOY_DEPLOYMENT_GROUP_NAME --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/orury-dev.zip