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 store
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 }}" >> ./store/.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: ./store
run: npm install
- name: react build
working-directory: ./store
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: ./store
env:
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME_STORE }}
run: |
aws s3 sync \
./build s3://$BUCKET_NAME
- name: CloudFront 캐시 무력화 설정
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_ID_STORE }}
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 }}