diff --git a/.github/workflows/build-to-cloudflare-pages.yml b/.github/workflows/build-to-cloudflare-pages.yml deleted file mode 100644 index 48c35ab8610..00000000000 --- a/.github/workflows/build-to-cloudflare-pages.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Build to Cloudflare Pages - -permissions: - actions: write - checks: write - contents: write - deployments: write - pull-requests: write - statuses: write - -on: - pull_request: - types: [opened, synchronize] - -env: - NODE_OPTIONS: '--max-old-space-size=8192' - -concurrency: - group: cloudflare-pages-build-${{ github.head_ref }} - cancel-in-progress: true - -jobs: - build_to_cloudflare_pages: - runs-on: Ubuntu-latest - steps: - - name: Checkout to repo - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Setup node - uses: actions/setup-node@v2 - - - name: Generate build status comment - id: build_status_comment - uses: actions/github-script@v3 - with: - script: | - const preview_url = "https://" + "${{ github.head_ref }}" + ".deriv-com.pages.dev" - const comment = [ - '## Cloudflare Pages Preview link', - '| Name | Result |', - '| :--- | :------ |', - `| **Build status** | In progress ⏳ |`, - `| **Preview URL** | [Visit Preview](${preview_url}) |`, - '' - ].join('\n') - core.setOutput("comment", comment); - - - name: Update build status comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - only_update: true - header: Cloudflare Pages Preview Comment - number: ${{github.event.issue.number}} - message: ${{steps.build_status_comment.outputs.comment}} - - - name: Get build output from master cache - uses: actions/cache/restore@v3 - with: - key: master-cache-public - restore-keys: | - master-cache-public-replica - path: | - .cache - public - - - name: Get cached dependencies - id: cache-npm - uses: actions/cache/restore@v3 - with: - path: node_modules - key: npm-${{ hashFiles('**/package-lock.json') }} - - - name: Install dependencies - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} - run: npm ci - - - name: Build project - id: build-project - run: npm run build - - - name: Publish to Cloudflare Pages - uses: cloudflare/wrangler-action@2.0.0 - - with: - apiToken: ${{ secrets.CLOUDFLARE_TEST_LINKS_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_TEST_LINKS_ACCOUNT_ID }} - command: pages publish public --project-name=deriv-com --branch=${GITHUB_REF_NAME} - echo "preview_url=$(pages info --project-name=deriv-com --branch=${GITHUB_REF_NAME} --format preview_url)" >> $GITHUB_OUTPUT - - - name: Retrieve Cloudflare Pages Preview URL - id: cloudflare_pages_preview_url - uses: actions/github-script@v3 - with: - script: | - const preview_url = "${{ steps.publish-to-pages.outputs.preview_url }}" - const comment = [ - '| Name | Result |', - '| :--- | :------ |', - `| **Build status** | Completed ✅ |`, - `| **Preview URL** | [Visit Preview](${preview_url}) |`, - '' - ].join('\n') - core.setOutput("comment", comment); - - - name: Post Cloudflare Pages Preview comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: Cloudflare Pages Preview Comment - number: ${{github.event.issue.number}} - message: ${{steps.cloudflare_pages_preview_url.outputs.comment}}