From 6a5aacd6f273a38c7b85cce9523212ef0a51cb76 Mon Sep 17 00:00:00 2001 From: Mohammed Rabil Date: Mon, 22 Apr 2024 21:57:55 +0530 Subject: [PATCH] feat: Add workflow to sync build assets to CDN --- .github/workflows/sync-assets.yml | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/sync-assets.yml diff --git a/.github/workflows/sync-assets.yml b/.github/workflows/sync-assets.yml new file mode 100644 index 0000000..fad8b21 --- /dev/null +++ b/.github/workflows/sync-assets.yml @@ -0,0 +1,36 @@ +name: Sync build assets to CDN + +on: + push: + branches: + - main + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout Website + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Sync build assets + uses: patrickwyler/gcs-bucket-sync-action@1.4 + with: + secrets: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_CREDENTIALS }} + bucket: "tiara-assets" + exclude: '.*\.md$|\.gitignore$|\.git/.*$|\.github/.*$' + sync_dir_from: ".next/static" + sync_dir_to: "assets/_next/static" + \ No newline at end of file