You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4.3 KiB
4.3 KiB
+++ title = "Write .gitea/workflows/deploy-ui.yml — Gitea Actions workflow to build and deploy UI to Cloudflare Pages" priority = 4 status = "done" ticket_type = "task" dependencies = ["ae886f", "dc3d2b"] +++
Build strategy resolved in triage fc9bfd: pre-built artifact + Gitea Actions + `wrangler pages deploy`.The Gitea instance at gitea.elijah.run runs Gitea Actions (GitHub Actions-compatible YAML). The workflow must:
- Trigger on push to the
quotesdbbranch - Build the Yew/Wasm UI with
trunk build --release - Deploy the
dist/output to Cloudflare Pages viawrangler pages deploy
The Cloudflare Pages project (quotesdb-ui) is created by OpenTofu (ticket ae886f) and must exist before this workflow can successfully deploy.
name: Deploy quotesdb UI
on: push: branches: - quotesdb paths: - "quotesdb/**"
jobs: deploy-ui: runs-on: ubuntu-latest defaults: run: working-directory: quotesdb
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain with wasm32 target
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
quotesdb/target
key: ${{ runner.os }}-cargo-ui-${{ hashFiles("quotesdb/Cargo.lock") }}
restore-keys: |
${{ runner.os }}-cargo-ui-
- name: Install Trunk
run: |
curl -fsSL https://github.com/trunk-rs/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz \
| tar -xz -C ~/.cargo/bin
- name: Build UI with Trunk
run: trunk build --release
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist/ --project-name quotesdb-ui --branch main
</implementation>
<secrets>
The following repository secrets must be configured in Gitea (Settings → Secrets):
| Secret | Description |
|--------|-------------|
| `CLOUDFLARE_API_TOKEN` | Cloudflare API token with Pages:Edit and Account:Read permissions |
| `CLOUDFLARE_ACCOUNT_ID` | Cloudflare account ID (visible in the Cloudflare dashboard URL) |
Documentation for secrets is tracked in ticket 71b1d4.
</secrets>
<notes>
- The workflow file lives at the **repository root** (`.gitea/workflows/`), not inside `quotesdb/`. Gitea Actions discovers workflows from the repo root.
- `working-directory: quotesdb` ensures all `run` steps execute from the project directory.
- `paths: ["quotesdb/**"]` limits deploys to pushes that actually change the UI project, avoiding spurious rebuilds.
- Trunk downloads the latest release binary from GitHub; pin to a specific version for reproducibility once stable.
- `wrangler-action@v3` handles `npx wrangler` invocation internally — no separate Node.js/wrangler install needed.
- `--branch main` tells Pages this deployment is for the production branch (matches `production_branch = "quotesdb"` in OpenTofu — adjust if Pages branch naming differs).
</notes>
<constraints>
- The Cloudflare Pages project (`quotesdb-ui`) must already exist (created by OpenTofu ticket ae886f) before the first deploy succeeds.
- `trunk build --release` must succeed locally before this workflow is useful; verify with `trunk build` first.
- Do not commit `CLOUDFLARE_API_TOKEN` or any secrets to the repository.
</constraints>
<validation>
After creating the workflow file:
1. Push to the `quotesdb` branch
2. Confirm the Gitea Actions run succeeds (Actions tab in Gitea UI)
3. Confirm the deployment appears in the Cloudflare Pages dashboard under `quotesdb-ui`
</validation>
<commit>
`ci(quotesdb): add Gitea Actions workflow to build and deploy UI to Cloudflare Pages`
</commit>