Skip to content

Update main.yml

Update main.yml #21

Workflow file for this run

name: AWS Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code.
uses: actions/checkout@v3
- name: Check Node v
run: node -v
- name: Create env file
run: |
echo "VITE_BACK_URL=${{ secrets.VITE_BACK_URL }}" >> .env
echo "VITE_BASE_URL= ${{ secrets.VITE_BASE_URL }}" >> .env
echo "VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }}" >> .env
echo "VITE_KAKAO_KEY=${{ secrets.VITE_KAKAO_KEY }}" >> .env
echo "VITE_KAKAO_REST_API=${{ secrets.VITE_KAKAO_REST_API }}" >> .env
echo "VITE_NAVER_CLIENT_ID=${{ secrets.VITE_NAVER_CLIENT_ID }}" >> .env
echo "VITE_NAVER_CLIENT_KEY=${{ secrets.VITE_NAVER_CLIENT_KEY }}" >> .env
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
env:
CI: ""
- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: "dist"
- name: CloudFront Invalidation
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }}
CLOUD_FRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
run: |
aws cloudfront create-invalidation \
--distribution-id $CLOUD_FRONT_ID --paths /*