Update main.yml #14
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: React build and deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code # 레포지토리 체크아웃 | |
uses: actions/checkout@v2 | |
- name: Cache node modules # node modules 캐싱 | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies # 의존 파일 설치 | |
run: npm install | |
- name: Build # React Build | |
run: npm run build | |
- name: List build directory contents # 확인을 위해 빌드 디렉토리 내용 출력 | |
run: ls -alh build | |
- name: Deploy # S3에 배포하기 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
aws s3 sync build s3://yebang-bucket --region ap-northeast-2 |