Skip to content

SeokminHong/pages-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Pages Action

typescript-action status

Deploy your Cloudflare Pages by GitHub Actions.

Motivation

Cloudflare Pages' automatic git deployments are really powerful and easy to use. However, when you're working in monorepo, or if you just change README.md only, it may make you uncomfortable to trigger deployment. So I automated the deployment with GitHub Action, using Cloudflare v4 API.

This action request Cloudflare Pages to build the main branch and poll the response until all steps are finished. It provides a greater experience than simply calling deploy hooks because if you just call the deploy hooks, you cannot notice whether the build fails or not.

Inputs

Usage

name: Publish page

on:
  push:
    # It deploys when the main branch changes only.
    branches: [main]
    # It deploys when the following files/directories are changed only.
    paths:
      - packages/pages/**
      - .github/workflows/publish-page.yml

jobs:
  publish:
    name: Publish to Cloudflare Pages
    runs-on: ubuntu-latest
    steps:
      - name: Deploy pages
        uses: SeokminHong/[email protected]
        with:
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          projectName: {{ page_name }}
          token: ${{ secrets.CLOUDFLARE_TOKEN }}
          branch: dev