Skip to content

Merge pull request #5 from potenday-project/development #5

Merge pull request #5 from potenday-project/development

Merge pull request #5 from potenday-project/development #5

Workflow file for this run

name: CI
on:
push:
branches: [release]
pull_request:
branches: [release]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
env:
REACT_APP_NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REACT_APP_NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }}
REACT_APP_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
REACT_APP_KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: '${{ secrets.AWS_REGION }}'
steps:
- name: Checkout source code.
uses: actions/checkout@master
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Generate Environment Variables File for Production
run: |
echo "REACT_APP_BASE_URL=$REACT_APP_BASE_URL" >> .env.production
echo "REACT_APP_SOCIAL_URL=$REACT_APP_SOCIAL_URL" >> .env.production
echo "REACT_APP_SOCKET_BASE_URL=$REACT_APP_SOCKET_BASE_URL" >> .env.production
echo "REACT_APP_IMAGE_BUCKET=$REACT_APP_IMAGE_BUCKET" >> .env.production
echo "REACT_APP_ACCESS_KEY=$REACT_APP_ACCESS_KEY" >> .env.production
echo "REACT_APP_SECRET_ACCESS_KEY=$REACT_APP_SECRET_ACCESS_KEY" >> .env.production
echo "REACT_APP_REGION=$REACT_APP_REGION" >> .env.production
env:
REACT_APP_NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REACT_APP_NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }}
REACT_APP_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
REACT_APP_KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
REACT_APP_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
REACT_APP_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
REACT_APP_REGION: ${{ secrets.AWS_REGION }}
- name: Install Dependencies
run: npm install
- name: Build
run: CI=false npm run build
- name: Deploy
run: |
aws s3 sync \
--region ${{ secrets.AWS_REGION }} \
build s3://${{ secrets.AWS_S3_BUCKET_NAME }} \
--delete
- name: Invalidate cache CloudFront
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
PATHS: '/index.html'
continue-on-error: true