ejangi / pages-trigger

Ad-hoc deployments for Cloudflare Pages projects using GitHub Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pages-trigger

Ad-hoc deployments for Cloudflare Pages projects using GitHub Actions

While Cloudflare Pages' API documentation is in development, this codebase is a glimpse at how to use the "Create deployment" endpoint to arbitrarily deploy existing projects, using GitHub Actions.

NOTICE The API used in this project is subject to change, don't rely on it yet for production workflows!

Setup

Fork this repository and set the following secrets in your project's Secrets page:

  • CF_API_KEY: your Global API Key. In the future, you'll be able to set a Pages-specific API token that only has access to your Pages projects, but for now, your Global API Key gives you access to Pages resources.
  • CF_ACCOUNT_ID: the Cloudflare Account ID that contains your Pages projects.
  • CF_EMAIL: your Cloudflare email.

Usage

Workflow Dispatch (UI deployment)

Visit the Actions tab on your repository - you may need to manually enable Actions running on your repo fork. Once enabled, go to the "Deploy Pages project" workflow, and manually trigger a deploy in the UI, providing a project name to deploy.

UI Deployment

Repository Dispatch (API/automatic deployment)

You can automate deployments using this workflow via the repository_dispatch event. Send an API request to your repo's dispatch endpoint (POST /repos/{owner}/{repo}/dispatches), specifying a project_name inside of the client_payload. For an example cURL request, see examples/repository_dispatch.sh.

About

Ad-hoc deployments for Cloudflare Pages projects using GitHub Actions


Languages

Language:Shell 100.0%