From 7157c9a72d18ecaa97637dc2ec3af842cbda64cd Mon Sep 17 00:00:00 2001 From: Gabriel Penteado Date: Wed, 23 Oct 2024 01:19:24 -0300 Subject: [PATCH] ci: pull request and main preview deployment with cloudflare pages --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 403b69b..dd70065 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,35 @@ jobs: - name: Run typecheck run: npm run typecheck + + build_deploy: + runs-on: ubuntu-latest + needs: typecheck + permissions: + contents: read + deployments: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Install dependencies + run: npm install + + - name: Build frontend + run: npm run build + + - name: Deploy to Cloudflare Pages + id: deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + command: pages deploy ./dist --project-name=cv-generator --branch=${{ github.ref_name }}