Skip to content

Merge pull request #75 from MoaRoom/feat/#72 #26

Merge pull request #75 from MoaRoom/feat/#72

Merge pull request #75 from MoaRoom/feat/#72 #26

Workflow file for this run

name: Deploy to Amazon EC2
on:
push:
branches:
- develop
env:
S3_BUCKET_NAME: moaroom-frontend-codedeploy
CODE_DEPLOY_APPLICATION_NAME: moaroom-frontend
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: moaroom-frontend-dg
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v2
- name: Check Node v # Node v 확인
run: node -v
- name: Install Dependencies # 의존 파일 설치
run: npm install
- name: Build # React Build
run: npm run build
- name: zip create
run: zip -qq -r ./build-fe.zip .
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 AWS S3
run: |
aws s3 cp --region ${{ secrets.AWS_REGION }} ./build-fe.zip s3://$S3_BUCKET_NAME/build-fe.zip
- name: Deploy to AWS EC2 from S3
run: aws deploy create-deployment
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }}
--deployment-config-name CodeDeployDefault.AllAtOnce
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }}
--s3-location bucket=$S3_BUCKET_NAME,key=build-fe.zip,bundleType=zip