Skip to content

feat(FE): 의과 약전 컴포넌트 구현 (#142) #2

feat(FE): 의과 약전 컴포넌트 구현 (#142)

feat(FE): 의과 약전 컴포넌트 구현 (#142) #2

name: Frontend Staging Deploy
on:
push:
branches:
- develop
paths:
- frontend/**
- .github/**
jobs:
deploy:
env:
ENV_PATH: .env.staging
environment: staging
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- name: Git Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: "**/yarn.lock"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Create .env file
run: |
touch ${{ env.ENV_PATH }}
cat ${{ env.ENV_PATH }}
- name: Install Dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_S3_REGION }}
- name: Deploy to S3
run: |
aws s3 sync ./dist s3://${{ secrets.AWS_S3_BUCKET_NAME_FRONTEND_STAGING }} \
--delete \
--acl public-read \
--cache-control "max-age=0, no-cache, no-store, must-revalidate"
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_STAGING }} \
--paths "/*"