-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from 100-hours-a-week/feature/deploy
Feature/deploy
- Loading branch information
Showing
10 changed files
with
87 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: CI/CD React Build with npm caching, deploy to AWS S3 | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 코드 체크아웃 | ||
uses: actions/checkout@v3 | ||
|
||
- name: npm 캐시 설정 | ||
uses: actions/[email protected] | ||
id: npm-cache | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('travelday-fe/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: npm 캐시 확인 | ||
if: steps.npm-cache.outputs.cache-hit == 'true' | ||
run: echo 'npm cache hit!' | ||
working-directory: travelday-fe | ||
|
||
- name: npm 캐시 미스 | ||
if: steps.npm-cache.outputs.cache-hit != 'true' | ||
run: echo 'npm cache missed!' | ||
working-directory: travelday-fe | ||
|
||
- name: 의존성 설치 및 빌드 | ||
run: | | ||
npm ci | ||
CI=false npm run build | ||
working-directory: travelday-fe | ||
env: | ||
REACT_APP_GOOGLE_MAP_KEY: ${{ secrets.REACT_APP_GOOGLE_MAP_KEY }} | ||
REACT_APP_FIREBASE_KEY: ${{secrets.REACT_APP_FIREBASE_KEY}} | ||
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{secrets.REACT_APP_FIREBASE_AUTH_DOMAIN}} | ||
REACT_APP_FIREBASE_PROJECT_ID: ${{secrets.REACT_APP_FIREBASE_PROJECT_ID}} | ||
REACT_APP_FIREBASE_STORAGEBUCKET: ${{secrets.REACT_APP_FIREBASE_STORAGEBUCKET}} | ||
REACT_APP_FIREBASE_MESSAGING_SENDER: ${{secrets.REACT_APP_FIREBASE_MESSAGING_SENDER}} | ||
REACT_APP_FIREBASE_APPID: ${{secrets.REACT_APP_FIREBASE_APPID}} | ||
REACT_APP_GENERATED_SERVER_URL : ${{secrets.REACT_APP_DEV_BACK_SERVER_URL}} | ||
|
||
|
||
- name: AWS IAM 사용자 설정 | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
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: 빌드한 파일 S3에 업로드 | ||
run: aws s3 sync build/ s3://${{ secrets.S3_DEV_BUCKET_NAME }} --acl public-read | ||
working-directory: travelday-fe | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
- name: CloudFront 캐시 무력화 설정 | ||
uses: chetan/invalidate-cloudfront-action@v2 | ||
env: | ||
DISTRIBUTION: ${{ secrets.AWS_DEV_CLOUDFRONT_ID }} | ||
PATHS: "/index.html" | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
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
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
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
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
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
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
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
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
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