From eafe7c110936baf980fbf2fcaefd870b595e4fa5 Mon Sep 17 00:00:00 2001 From: Jeremy <102432453+shackstack@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:48:49 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=A0=ED=8A=B8=EC=97=94?= =?UTF-8?q?=EB=93=9C=20prod=20cd=20=ED=8C=8C=EC=9D=B4=ED=94=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/frontend-prod-cd.yml | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/frontend-prod-cd.yml diff --git a/.github/workflows/frontend-prod-cd.yml b/.github/workflows/frontend-prod-cd.yml new file mode 100644 index 000000000..13183c068 --- /dev/null +++ b/.github/workflows/frontend-prod-cd.yml @@ -0,0 +1,52 @@ +name: ✨ Celuveat frontend CD ✨ + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: ./frontend + concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + + steps: + - name: ✨ Checkout repository + uses: actions/checkout@v3 + + - name: ✨ Node.js 설정 + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: 환경변수 설정 + run: | + echo "BASE_URL=$BASE_URL" >> .prod.env + echo "GOOGLE_MAP_API_KEY=$GOOGLE_MAP_API_KEY" >> .prod.env + echo "SHARE_KAKAO_LINK_KEY=$SHARE_KAKAO_LINK_KEY" >> .prod.env + env: + BASE_URL: ${{secrets.PROD_BASE_URL}} + GOOGLE_MAP_API_KEY: ${{secrets.GOOGLE_MAP_API_KEY}} + SHARE_KAKAO_LINK_KEY: ${{secrets.SHARE_KAKAO_LINK_KEY}} + + - name: ✨ 의존성 설치 + run: yarn install + + - name: ✨ 빌드 + run: yarn build:prod + + - name: ✨ 배포 + env: + SOURCE_DIR: './dist' + AWS_REGION: 'ap-northeast-2' + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_S3_BUCKET_URI: ${{ secrets.AWS_S3_BUCKET_URI }} + run: | + aws s3 rm $AWS_S3_BUCKET_URI —-recursive —-exclude 'images-data/*' —-exclude 'review/*' —-exclude "*.jpeg" --exclude "event/*" + aws s3 sync $SOURCE_DIR $AWS_S3_BUCKET_URI