Skip to content

πŸš‘ fix: CI/CD 버그 μˆ˜μ • (#60) #101

πŸš‘ fix: CI/CD 버그 μˆ˜μ • (#60)

πŸš‘ fix: CI/CD 버그 μˆ˜μ • (#60) #101

Workflow file for this run

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 "/*"