From 2d90caafc6f4d2c202175831e83c5ba283e00607 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 2 Aug 2023 12:05:59 +0500 Subject: [PATCH] ci: use unlike-ltd/github-actions-cloudflare-pages for deployment --- .github/workflows/web.beta.publish.yml | 22 ++++++++++++++++++---- .github/workflows/web.publish.yml | 12 ++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/web.beta.publish.yml b/.github/workflows/web.beta.publish.yml index dedec51be..046759b82 100644 --- a/.github/workflows/web.beta.publish.yml +++ b/.github/workflows/web.beta.publish.yml @@ -4,8 +4,14 @@ on: workflow_dispatch: push: branches: - - "master" - + - master + pull_request: + types: + - closed + - ready_for_review + - reopened + branches: + - master jobs: build: name: Build @@ -31,5 +37,13 @@ jobs: - name: Generate beta build run: npm run build:beta:web - - name: Publish on Cloudflare Pages - run: npx --yes wrangler pages deploy --branch master --project-name=notesnook-beta-app ./apps/web/build/ + - name: Publish to Cloudflare Pages + uses: unlike-ltd/github-actions-cloudflare-pages@v0.1.1 + id: pages + with: + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + cloudflare-project-name: notesnook-beta-app + directory: ./apps/web/build + github-token: ${{ secrets.GITHUB_TOKEN }} + github-environment: ${{ (github.ref == 'refs/heads/master' && 'beta') || 'preview' }} diff --git a/.github/workflows/web.publish.yml b/.github/workflows/web.publish.yml index 28bb7e464..568ed10c1 100644 --- a/.github/workflows/web.publish.yml +++ b/.github/workflows/web.publish.yml @@ -27,5 +27,13 @@ jobs: - name: Generate build run: npm run build:web - - name: Publish on Cloudflare Pages - run: npx --yes wrangler pages deploy --project-name=notesnook-app ./apps/web/build/ + - name: Publish to Cloudflare Pages + uses: unlike-ltd/github-actions-cloudflare-pages@v0.1.1 + id: pages + with: + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + cloudflare-project-name: notesnook-app + directory: ./apps/web/build + github-token: ${{ secrets.GITHUB_TOKEN }} + github-environment: production