From 08ac30356890b42613088af5ef4bf836204c7eca Mon Sep 17 00:00:00 2001 From: Jinhyun Park Date: Thu, 24 Mar 2022 18:10:26 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=ED=81=B4=EB=9D=BC=EC=9D=B4=EC=96=B8?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=B0=ED=8F=AC=20=EC=9E=90=EB=8F=99=ED=99=94=20?= =?UTF-8?q?close=20#353?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..b9f7b175 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,48 @@ +name: deploy-to-42ByteClientS3 + +on: + push: + branches: [deploy] + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: git clone + uses: actions/checkout@v2 + + - name: npm install for eslint + run: npm install + + - name: npm install + run: npm install + working-directory: ./client + + - name: build + env: + REACT_APP_ACCESS_ID: ${{ secrets.REACT_APP_ACCESS_ID }} + REACT_APP_ACCESS_KEY: ${{ secrets.REACT_APP_ACCESS_KEY }} + REACT_APP_BUCKET_NAME: ${{ secrets.REACT_APP_BUCKET_NAME }} + REACT_APP_REGION: ${{ secrets.REACT_APP_REGION }} + REACT_APP_SERVERIP: ${{ secrets.REACT_APP_SERVERIP }} + run: CI='' npm run build + working-directory: ./client + + - name: Transfer to S3 for serving static + uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read --follow-symlinks --delete + env: + AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_IAM_MANAGER_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_IAM_MANAGER_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_BUCKET_REGION }} + SOURCE_DIR: '/home/runner/work/blind-42/42byte/client/build' + + - name: 캐시 무효화 + env: + AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_IAM_MANAGER_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_IAM_MANAGER_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_BUCKET_REGION }} + run: aws cloudfront create-invalidation --distribution-id=E12HWSI28LDLX4 --paths "/*"