From 27b0e15cd9554d03e476372bfa56b26ea729dd2d Mon Sep 17 00:00:00 2001 From: Ostend Suryajaya Date: Mon, 20 May 2024 16:06:14 -0700 Subject: [PATCH] Add CD-prod.yml --- .github/workflows/CD-prod.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/CD-prod.yml diff --git a/.github/workflows/CD-prod.yml b/.github/workflows/CD-prod.yml new file mode 100644 index 0000000..ee81ebe --- /dev/null +++ b/.github/workflows/CD-prod.yml @@ -0,0 +1,52 @@ +name: S3 Deploy +on: + push: + branches: + - main +env: + NODE_ENV: ${{ secrets.NODE_ENV }} + VITE_FIREBASE_APIKEY: ${{ secrets.VITE_FIREBASE_APIKEY }} + VITE_FIREBASE_AUTHDOMAIN: ${{ secrets.VITE_FIREBASE_AUTHDOMAIN }} + VITE_FIREBASE_PROJECTID: ${{ secrets.VITE_FIREBASE_PROJECTID }} + VITE_FIREBASE_STORAGEBUCKET: ${{ secrets.VITE_FIREBASE_STORAGEBUCKET }} + VITE_FIREBASE_MESSAGINGSENDERID: ${{ secrets.VITE_FIREBASE_MESSAGINGSENDERID }} + VITE_FIREBASE_APPID: ${{ secrets.VITE_FIREBASE_APPID }} + VITE_BACKEND_HOST: ${{ secrets.PROD_VITE_BACKEND_HOST }} + # …and any additional environment variables + +jobs: + run: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + + - name: Install dependencies + uses: borales/actions-yarn@v4 + with: + cmd: install + + - name: Build + uses: borales/actions-yarn@v4 + with: + cmd: build + + - name: Deploy + uses: reggionick/s3-deploy@v4 + with: + folder: dist + bucket: ${{ secrets.PROD_S3_BUCKET }} + bucket-region: ${{ secrets.S3_BUCKET_REGION }} + dist-id: ${{ secrets.PROD_CLOUDFRONT_DISTRIBUTION_ID }} + invalidation: / + delete-removed: true + no-cache: true + private: true + filesToInclude: '.*/*,*/*,**' +