ci(website): Cloudflare Pages deploy via Gitea Actions
New .gitea/workflows/website.yaml: on a push to main or website that touches website/**, build the Astro site with pnpm and deploy website/dist to the `relplay` Cloudflare Pages project via wrangler — --branch selects production (main) vs preview (website). Runs on the bare ci-public runner (node present; pnpm via corepack). Pin pnpm with package.json's packageManager for deterministic corepack installs. Requires repo Actions secrets CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID.
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# Build the docs/marketing website and deploy it to Cloudflare Pages.
|
||||
#
|
||||
# One Pages project, two branches (no second project, no sub-folders — Pages
|
||||
# maps a branch to a *subdomain alias*, not a path):
|
||||
# main → production (the project's production branch → relplay.org)
|
||||
# website → preview (alias `website.<project>.pages.dev`; a custom
|
||||
# `staging.relplay.org` can be attached to it)
|
||||
# wrangler treats `--branch=<production-branch>` as a production deploy and any
|
||||
# other branch as a preview, so a single workflow covers both — the Pages
|
||||
# project's production branch MUST be set to `main`.
|
||||
#
|
||||
# Pure-Node build: the `.cast` recordings are committed, so no cargo/Rust is
|
||||
# needed here. Runs on the bare `ci-public` runner (node already present; pnpm
|
||||
# via corepack, pinned by package.json's `packageManager`). No job container —
|
||||
# unlike the Rust gate, this needs none.
|
||||
#
|
||||
# Required Actions secrets (set once in the repo/org settings):
|
||||
# CLOUDFLARE_API_TOKEN — token with "Cloudflare Pages: Edit" on the account
|
||||
# CLOUDFLARE_ACCOUNT_ID — the account id that owns the Pages project
|
||||
name: website
|
||||
on:
|
||||
push:
|
||||
branches: [main, website]
|
||||
# Only when the site (or this workflow) actually changes — crate-only
|
||||
# pushes don't redeploy the site.
|
||||
paths:
|
||||
- 'website/**'
|
||||
- '.gitea/workflows/website.yaml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ci-public
|
||||
defaults:
|
||||
run:
|
||||
working-directory: website
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: preflight — toolchain present
|
||||
run: |
|
||||
node --version
|
||||
corepack --version
|
||||
|
||||
- name: enable pnpm (pinned by packageManager)
|
||||
run: corepack enable
|
||||
|
||||
- name: install
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: build
|
||||
run: pnpm build
|
||||
|
||||
- name: deploy to Cloudflare Pages
|
||||
shell: bash
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# `dist` is relative to website/ (the working-directory). The branch
|
||||
# name decides production (main) vs preview (anything else).
|
||||
npx --yes wrangler@4 pages deploy dist \
|
||||
--project-name=relplay \
|
||||
--branch="$BRANCH"
|
||||
@@ -3,6 +3,7 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
|
||||
Reference in New Issue
Block a user