From 674cb254f08730f72c0dd55133b4a44fddb2969c Mon Sep 17 00:00:00 2001 From: joojjang Date: Wed, 20 Nov 2024 14:23:33 +0900 Subject: [PATCH] =?UTF-8?q?!HOTFIX:=20=EA=B9=83=ED=97=99=20yaml=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/prod-ci.yml | 78 ++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prod-ci.yml b/.github/workflows/prod-ci.yml index 4c56950..2b41055 100644 --- a/.github/workflows/prod-ci.yml +++ b/.github/workflows/prod-ci.yml @@ -5,7 +5,7 @@ on: branches: - Master tags: - - "production-**" + - 'production-**' jobs: Deploy: @@ -48,6 +48,82 @@ jobs: - name: Build run: pnpm build + # 추가: 개행 문자 제거 + - name: Sanitize UNIVCERT API key + run: echo "${{ secrets.VITE_APP_UNIVCERT_API_KEY }}" | tr -d '\n' > sanitized_key.txt + + - name: Export sanitized API key + run: echo "VITE_APP_UNIVCERT_API_KEY=$(cat sanitized_key.txt)" >> $GITHUB_ENV + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }} + aws-region: ap-northeast-2 + + - name: Deploy to S3 + run: aws s3 sync ./dist s3://${{ secrets.AWS_S3_BUCKET_NAME }} --delete + + - name: Invalidate CloudFront Cache + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/*" +name: MASTER CI + +on: + push: + branches: + - Master + tags: + - 'production-**' + +jobs: + Deploy: + runs-on: ubuntu-latest + + env: + VITE_APP_BASE_URL: ${{ secrets.VITE_APP_BASE_URL }} + VITE_APP_BASE_URL_CHAT: ${{ secrets.VITE_APP_BASE_URL_CHAT }} + VITE_APP_NTS_BUSINESSMAN_API_KEY: ${{ secrets.VITE_APP_NTS_BUSINESSMAN_API_KEY }} + VITE_APP_UNIVCERT_API_KEY: ${{ secrets.VITE_APP_UNIVCERT_API_KEY }} + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2 + with: + version: latest + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '18' + cache: 'pnpm' + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + **/node_modules + ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: Install Dependencies + run: pnpm install + + - name: Build + run: pnpm build + + # 추가: 개행 문자 제거 + - name: Sanitize UNIVCERT API key + run: echo "${{ secrets.VITE_APP_UNIVCERT_API_KEY }}" | tr -d '\n' > sanitized_key.txt + + - name: Export sanitized API key + run: echo "VITE_APP_UNIVCERT_API_KEY=$(cat sanitized_key.txt)" >> $GITHUB_ENV + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: