🚑 fix: URI 수정 #109
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: PROMA-FRONT-CI/CD | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
types: | |
- closed | |
branches: | |
- dev | |
jobs: | |
build: | |
name: PROMA-FRONT-CI/CD | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true || github.event_name == 'push' | |
steps: | |
- name: Github Action 설정 | |
uses: actions/checkout@v3 | |
- name: NPM 이용 cache 설정 | |
id: npm-cache-dir | |
run: | | |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: 라이브러리 설치 및 업데이트 | |
run: npm install | |
- name: 환경 변수 설정 | |
run: | | |
echo "REACT_APP_BACKEND_SERVER_URL=${{ secrets.REACT_APP_BACKEND_SERVER_URL }}" >> .env | |
echo "REACT_APP_AI_SERVER_URL=${{ secrets.REACT_APP_AI_SERVER_URL }}" >> .env | |
echo "REACT_APP_REGION=${{ secrets.REACT_APP_REGION }}" >> .env | |
echo "REACT_APP_ACCESS_KEY_ID=${{ secrets.REACT_APP_ACCESS_KEY_ID }}" >> .env | |
echo "REACT_APP_SECRET_ACCESS_KEY=${{ secrets.REACT_APP_SECRET_ACCESS_KEY }}" >> .env | |
echo "REACT_APP_BUCKET_NAME=${{ secrets.REACT_APP_BUCKET_NAME }}" >> .env | |
- name: react 빌드 | |
run: npm run build | |
- name: AWS 인증 | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }} | |
aws-region: ap-northeast-2 | |
- name: S3 자동 배포 | |
env: | |
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME}} | |
run: | | |
aws s3 sync \ | |
./build s3://$BUCKET_NAME | |
- name: CloudFront 무효화 설정 | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/*" |