Skip to content

Merge branch 'main' of https://github.com/lotteon2/BB-FRONTEND #106

Merge branch 'main' of https://github.com/lotteon2/BB-FRONTEND

Merge branch 'main' of https://github.com/lotteon2/BB-FRONTEND #106

Workflow file for this run

name: Front Deployment
on:
push:
branches:
- main
jobs:
build_mall:
name: Build and Deploy Mall
runs-on: ubuntu-latest
steps:
- name: checkout Github Action
uses: actions/checkout@v3
# .env에 있던 환경변수들을 등록해주는 단계
- name: .env setting
run: |
echo "REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}" >> ./mall/.env
echo "REACT_APP_KAKAO_APP_KEY=${{ secrets.REACT_APP_KAKAO_APP_KEY }}" >> ./mall/.env
echo "REACT_APP_KAKAO_REST_API_KEY=${{ secrets.REACT_APP_KAKAO_REST_API_KEY }}" >> ./mall/.env
echo "REACT_APP_KAKAO_JS_API_KEY=${{ secrets.REACT_APP_KAKAO_JS_API_KEY }}" >> ./mall/.env
echo "REACT_APP_KAKAO_REDIRECT_URI=${{ secrets.REACT_APP_KAKAO_REDIRECT_URI }}" >> ./mall/.env
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('mall/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install npm dependencies
working-directory: ./mall
run: npm install
- name: react build
working-directory: ./mall
run: npm run build
- name: Configure AWS credentials
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: Upload to S3
working-directory: ./mall
env:
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME_MALL }}
run: |
aws s3 sync \
./build s3://$BUCKET_NAME
- name: CloudFront 캐시 무력화 설정
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_ID_MALL }}
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }}