Skip to content

Merge pull request #177 from ODOICHON/hotfix/#175 #21

Merge pull request #177 from ODOICHON/hotfix/#175

Merge pull request #177 from ODOICHON/hotfix/#175 #21

Workflow file for this run

name: Deploy
on:
push:
branches: 'main'
env:
PROJECT_NAME: duaily-client
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v2
- name: Check Node v # Node v ํ™•์ธ
run: node -v
- name: Cache node modules # node modules ์บ์‹ฑ
uses: actions/cache@v1
with: # with ๊ตฌ๋ฌธ์œผ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, path์™€ key๋ฅผ ๋ฐ˜๋“œ์‹œ ์„ค์ •ํ•ด์ฃผ์–ด์•ผ ํ•จ
path: node_modules # ์ €์žฅํ•˜๊ณ  ๋ถˆ๋Ÿฌ์˜ฌ ์บ์‹œ ๋Œ€์ƒ ํด๋”
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} # ์ €์žฅํ•˜๊ณ  ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ ์‹๋ณ„ํ•  ์ˆ˜ ์žˆ๋Š” ํ‚ค ๊ฐ’
restore-keys:
| # ์บ์‹œ key๊ฐ€ ์ผ์น˜ํ•˜๋Š” ๊ฒƒ์ด ์—†์„ ๋•Œ, ์ฐจ์„ ํƒ์œผ๋กœ ์บ์‹ฑ ํด๋”๋ฅผ ์ฐพ๋Š” key
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Install Dependencies # ์˜์กด ํŒŒ์ผ ์„ค์น˜
run: yarn install --frozen-lockfile
- name: Setting .env (Dev)
run: echo "${{ secrets.REACT_ENV }}" >> .env
- name: Build # React Build
run: yarn build
- name: zip create # zip ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค
run: zip -r ./$GITHUB_SHA.zip ./dist appspec.yml
shell: bash
- 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 }}
- name: Upload to S3 # S3์— ํŒŒ์ผ ์—…๋กœ๋“œ
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://${{ secrets.S3_BUCKET_NAME }}/$PROJECT_NAME/$GITHUB_SHA.zip
- name: Code Deploy # CodeDeploy ๋ฐฐํฌ
run: |
aws deploy create-deployment \
--application-name duaily-deploy \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name duaily-deploy-group-client \
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip