Created
December 29, 2019 14:45
-
-
Save seye2/1c4b35af99cb991fadd47ec2f48d6499 to your computer and use it in GitHub Desktop.
job, needs, if 사용 코드
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 | |
on: | |
push: # master, develop Branch에서 push 이벤트가 일어났을 때만 실행 | |
branches: | |
- master | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Checkout source code. # 레포지토리 체크아웃 | |
uses: actions/checkout@v1 | |
- name: Cache node modules # node modules 캐싱 | |
uses: actions/cache@v1 | |
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: Archive production artifacts # upload file | |
uses: actions/upload-artifact@v1 | |
with: | |
name: build # artifact name | |
path: build # upload path | |
deploy_to_dev: | |
needs: build | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Download production artifacts # download file | |
uses: actions/download-artifact@v1 | |
with: | |
name: build # artifact name | |
- 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 cp \ | |
--recursive \ | |
--region ap-northeast-2 \ | |
build s3://github-actions-dh/develop # develop branch 디렉토리로 배포 | |
if: contains(github.ref, 'develop') # github branch가 develop일 때만 develop_to_dev를 실행한다. | |
deploy_to_prod: | |
needs: build | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Download production artifacts # download file | |
uses: actions/download-artifact@v1 | |
with: | |
name: build # artifact name | |
- 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 cp \ | |
--recursive \ | |
--region ap-northeast-2 \ | |
build s3://github-actions-dh/master # develop branch 디렉토리로 배포 | |
if: contains(github.ref, 'master') # github branch가 master일 때만 develop_to_prod를 실행한다. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment