π¨ Refactoring - api URI μμ (#65) #108
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 "/*" |