Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seokminhong/pages-action
Deploy Cloudflare Pages by GitHub Actions
https://github.com/seokminhong/pages-action
cloudflare-pages deployment github-actions
Last synced: 10 days ago
JSON representation
Deploy Cloudflare Pages by GitHub Actions
- Host: GitHub
- URL: https://github.com/seokminhong/pages-action
- Owner: SeokminHong
- License: mit
- Created: 2021-10-19T08:17:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T05:49:32.000Z (12 months ago)
- Last Synced: 2024-10-07T19:45:38.674Z (about 1 month ago)
- Topics: cloudflare-pages, deployment, github-actions
- Language: TypeScript
- Homepage:
- Size: 649 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pages Action
Deploy your [Cloudflare Pages](https://pages.cloudflare.com/) 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
- `accountId` (required): Cloudflare Account ID. See: https://developers.cloudflare.com/fundamentals/get-started/basic-tasks/find-account-and-zone-ids/
- `projectName` (required): Name of the Pages project.
- `token` (required): Authorization token of Cloudflare.
- `interval` (optional): Interval (ms) for polling. Default is `3000`.
- `branch` (optional): Name of a branch to deploy. If it isn't provided, the production branch will be chosen.## Usage
```yaml
name: Publish pageon:
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.ymljobs:
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
```