appspec.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy # Workflow 이름 | |
on: # Event 감지 | |
push: | |
branches: | |
- main # 해당 브랜치의 푸쉬가 일어날 때 CI/CD를 진행하겠다는 뜻 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code. # Repo checkout | |
uses: actions/checkout@v2 | |
- name: .env setting | |
run: echo "REACT_APP_HOST=${{ secrets.REACT_APP_HOST }}" >> .env.production | |
- name: Check Node v # Node v 확인 | |
run: node -v | |
- name: Install Dependencies # 의존 파일 설치 | |
run: yarn install --frozen-lockfile | |
- name: Build # React Build | |
run: yarn build | |
env: | |
CI: "" | |
- name: zip create | |
# zip 파일을 만듭니다(파일명은 자유, 대신 아래 workflow에 적을 파일명과 동일하게 맞춰주세요). | |
run: zip -qq -r ./mutsa-deploy.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 S3 # Upload build file to S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
aws s3 cp --region ap-northeast-2 ./mutsa-deploy.zip s3://mutsa-github-actions/mutsa-deploy.zip | |
- name: Deploy # Deploy to EC2 | |
run: aws deploy create-deployment | |
--application-name codeDeploy-mutsa-app | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name mutsa-deploy-group | |
--s3-location bucket=mutsa-github-actions,key=mutsa-deploy.zip,bundleType=zip |