模块 @pandapro-project/webtools-cf-pages - v0.0.2

webtools-cf-pages

Cf Pages for Github Actions

After you modify the action.ts file, you need to re-run pnpm run build to generate new products.

  1. Get cloudflare's build log information in real time

Github Action Secrets:

  • ACTIONS_PAT
  • CLOUDFLARE_API_TOKEN
  • CLOUDFLARE_ACCOUNT_ID
  • CLOUDFLARE_PROJECT_NAME
name: Deploy

on:
push:
tags:
- 'v*'

jobs:
deploy-prod:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Send POST request
run: |
# Send POST request to trigger cloudflare pages build

- name: Checkout Private Action Repository
uses: actions/checkout@v2
with:
repository: pandapro-project/web-tools # repository url; [owner/repo] like pandapro-project/web-tools
ref: main
token: ${{ secrets.ACTIONS_PAT }}

- name: Cf pages build progress
id: 'cf-pages-build-progress'
uses: ./packages/webtools-cf-pages/ # path to the action.yaml
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME}}

- name: Output build result
run: |
echo "Development id: ${{ steps.cf-pages-build-progress.outputs.deploymentId }}"
echo "Environment: ${{ steps.cf-pages-build-progress.outputs.environment }}"
echo "Website preview url: ${{ steps.cf-pages-build-progress.outputs.previewUrl }}"
echo "Build status: ${{ steps.cf-pages-build-progress.outputs.status}}"
  • deploymentId: Deployment id
  • environment: Environment, e.g. production or preview
  • previewUrl: Website preview url
  • status: Build status, if the build is successful, it will return success.
  • Cf Pages Build Progress Output Build Result

  • Output Build Result Output Build Result