Skip to content

Merge pull request #345 from Guzzing/dev #42

Merge pull request #345 from Guzzing/dev

Merge pull request #345 from Guzzing/dev #42

Workflow file for this run

name: Deploy to S3 and Invalidate CloudFront
on:
push:
branches:
- main # 또는 배포할 브랜치 이름
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: create env file
run: |
touch .env
echo VITE_API_ENDPOINT=${{secrets.VITE_API_ENDPOINT}} >> .env
echo VITE_CLIENT_ID=${{secrets.VITE_CLIENT_ID}} >> .env
echo VITE_CLIENT_SECRET=${{secrets.VITE_CLIENT_SECRET}} >> .env
echo VITE_REDIRECT_URL=${{secrets.VITE_REDIRECT_URL}} >> .env
echo VITE_KAKAO_CLIENT_ID=${{secrets.VITE_KAKAO_CLIENT_ID}} >> .env
echo VITE_KAKAO_CLIENT_SECRET_KEY=${{secrets.VITE_KAKAO_CLIENT_SECRET_KEY}} >> .env
echo VITE_GOOGLE_CLIENT_ID=${{secrets.VITE_GOOGLE_CLIENT_ID}} >> .env
echo VITE_GOOGLE_CLIENT_SECRET_KEY=${{secrets.VITE_GOOGLE_CLIENT_SECRET_KEY}} >> .env
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Deploy to S3
uses: jakejarvis/[email protected]
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}
AWS_REGION: 'ap-northeast-2'
SOURCE_DIR: 'dist' # React 빌드 결과물 디렉터리
- name: Invalidate CloudFront
uses: chetan/[email protected]
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_ID }}
PATHS: '/*'
AWS_REGION: 'ap-northeast-2'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}