supabase 마이그레이션, 코드 리팩토링 (#132) #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy To Production | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16.1 | |
- 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: Install Dependencies | |
run: npm install | |
- name: Build | |
env: | |
VITE_KAKAO_MAP_API_KEY: ${{ secrets.REACT_APP_KAKAO_MAP_API_KEY }} | |
VITE_SUPABASE_URL: https://izhutepzzveasglrlbcx.supabase.co | |
VITE_SUPABASE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Iml6aHV0ZXB6enZlYXNnbHJsYmN4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mjc5NTkyMzgsImV4cCI6MjA0MzUzNTIzOH0.kxdrs6OI-fD2QXsdmqZJx_Knm_gwDEXFYqgte46akEw | |
VITE_API_ERROR_HELPER_HOST: ${{ secrets.REACT_APP_API_ERROR_HELPER_HOST }} | |
VITE_GOOGLE_CLIENT_ID: ${{ secrets.VITE_GOOGLE_CLIENT_ID }} | |
run: npm run build | |
- name: Reinstall without Dev Dependencies | |
run: rm -rf node_modules && npm ci --only=production --ignore-scripts | |
- name: Deploy | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_BUCKET: ${{ secrets.AWS_BUCKET }} | |
run: | | |
aws s3 cp \ | |
--recursive \ | |
--region ap-northeast-2 \ | |
dist s3://$AWS_BUCKET | |
- name: Cloudfront Invalidation | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ap-northeast-2 | |
DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
run: | | |
aws cloudfront create-invalidation \ | |
--distribution-id $DISTRIBUTION_ID \ | |
--paths "/*" |