From 658939c0b936fdb17da337436694f1ae9aa592cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=A4hr?= Date: Tue, 7 Nov 2023 23:38:18 +0100 Subject: [PATCH] ci: add cloudflare pages --- .github/workflows/sveltekitci.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/sveltekitci.yml b/.github/workflows/sveltekitci.yml index e90d955a..7e8beeb2 100644 --- a/.github/workflows/sveltekitci.yml +++ b/.github/workflows/sveltekitci.yml @@ -4,6 +4,9 @@ on: pull_request: branches: - main + push: + branches: + - main workflow_dispatch: jobs: @@ -42,6 +45,15 @@ jobs: restore-keys: | ${{ runner.os }}-pnpm-store- + - name: Setup jampack cache + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + uses: actions/cache@v3 + with: + path: '.jampack' + key: jampack-${{ github.run_id }} + restore-keys: | + jampack + - name: Install dependencies run: pnpm install @@ -58,4 +70,23 @@ jobs: run: pnpm run build - name: Postbuild + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' run: pnpm run postbuild + + - name: Publish to Cloudflare Pages + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: stadtgeschichtebasel-ch + directory: build + # Optional: Enable this if you want to have GitHub Deployments triggered + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + # Optional: Switch what branch you are publishing to. + # By default this will be the branch which triggered this workflow + branch: main + # Optional: Change the working directory + # workingDirectory: my-site + # Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta` + # wranglerVersion: '3'