73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
name: CI
|
|
|
|
# Gitea Actions mirror of .github/workflows/ci.yml.
|
|
# Typecheck / test / build on every push & PR; deploy the SPA to Cloudflare
|
|
# Workers (static assets) on pushes to main.
|
|
#
|
|
# Required Gitea config (Repo → Settings → Actions → Secrets / Variables):
|
|
# Variable VITE_API_BASE_URL — Laravel API base URL baked into the build
|
|
# Secret CLOUDFLARE_API_TOKEN — token with "Edit Cloudflare Workers" scope
|
|
# Secret CLOUDFLARE_ACCOUNT_ID — Cloudflare account id
|
|
#
|
|
# Requires an act_runner registered with the `ubuntu-latest` label, using an
|
|
# image that has git + node bootstrapping (e.g. catthehacker/ubuntu:act-22.04).
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ci-${{ gitea.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check:
|
|
name: Typecheck, test & build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm run generate-routes
|
|
- run: pnpm run typecheck
|
|
- run: pnpm test
|
|
- run: pnpm run build
|
|
env:
|
|
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL }}
|
|
|
|
deploy:
|
|
name: Deploy to Cloudflare Workers
|
|
needs: check
|
|
if: gitea.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm run generate-routes
|
|
# cf:build runs `vite build` then copies the TanStack Start SPA shell
|
|
# (_shell.html) to index.html so Cloudflare's single-page-application
|
|
# fallback (wrangler.jsonc) returns it for every client route.
|
|
- name: Build SPA
|
|
run: pnpm run cf:build
|
|
env:
|
|
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL }}
|
|
- name: Deploy
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|