From 7d1919ce0ad61c3ca164dff0b3c2cc861a2e19ac Mon Sep 17 00:00:00 2001 From: Leejin Yang Date: Mon, 29 Jan 2024 20:18:25 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20S3=20=EB=B0=B0=ED=8F=AC=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=9E=91=EC=84=B1=20(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: S3 배포 스크립트 작성 * chore: S3 이전 파일 삭제 추가 * fix: 빌드 배포 과정 통합 * chore: 환경변수 추가 --- .github/workflows/deploy.yml | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..d3333d19 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,60 @@ +name: Frontend Deploy + +on: + pull_request: + branches: + - develop + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + timeout-minutes: 10 + + permissions: + checks: write + pull-requests: write + + steps: + - name: Repository 체크아웃 + uses: actions/checkout@v3 + + - name: Node 설정 + uses: actions/setup-node@v3 + with: + node-version: '18.16.1' + + - name: node_modules 캐싱 + id: cache + uses: actions/cache@v3 + with: + path: '**/node_modules' + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: 의존성 설치 + if: steps.cache.outputs.cache-hit != 'true' + run: yarn install --pure-lockfile + + - name: .env 파일 생성 + run: | + echo "CHANNEL_TALK_KEY=${{ secrets.CHANNEL_TALK_KEY }}" > .env + echo "GOOGLE_ANALYTICS_ID=${{ secrets.GOOGLE_ANALYTICS_ID }}" >> .env + + - name: 클라이언트 빌드 + run: yarn build + + - name: AWS CLI 설정 + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 + + - name: S3 이전 파일 삭제 + run: | + aws s3 rm ${{ secrets.AWS_S3_URL }} --recursive + + - name: S3에 배포 + run: | + aws s3 sync ./dist ${{ secrets.AWS_S3_URL }}