mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-13 00:50:01 +00:00
## Summary
Add support for deploying full ephemeral preview environments from
frontend PRs. This is the frontend-side half — it sends `pr_number` and
`variant` (cpu/gpu) in the dispatch payload, and adds a cleanup dispatch
on PR close/unlabel.
### Changes
- **`cloud-dispatch-build.yaml`** — Add `pr_number` and `variant` to the
`frontend-asset-build` dispatch payload. Variant is derived from which
preview label triggered the event (`preview-cpu` → cpu, else gpu).
- **`cloud-dispatch-cleanup.yaml`** (new) — Fire-and-forget dispatch of
`frontend-preview-cleanup` to the cloud repo when a frontend PR is
closed or has its preview label removed. Enables synchronized teardown.
### Companion PR
Cloud-side: Comfy-Org/cloud (creates the `deploy-frontend-preview` job,
extends the reconciler)
### How it works
1. Label a frontend PR with `preview`, `preview-cpu`, or `preview-gpu`
2. Assets build and upload to GCS (existing flow)
3. Cloud deploys a full ephemeral env at `fe-pr-{N}.testenvs.comfy.org`
using all `:main` service tags
4. Subsequent pushes update the frontend SHA via AppSet upsert
5. On close/unlabel, cleanup dispatch triggers immediate teardown
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9715-feat-dispatch-frontend-PR-preview-environments-to-cloud-31f6d73d3650819da1b5ca5ce419e06e)
by [Unito](https://www.unito.io)
40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
---
|
|
# Dispatches a frontend-preview-cleanup event to the cloud repo when a
|
|
# frontend PR with a preview label is closed or has its preview label
|
|
# removed. The cloud repo handles the actual environment teardown.
|
|
#
|
|
# This is fire-and-forget — it does NOT wait for the cloud workflow to
|
|
# complete. Status is visible in the cloud repo's Actions tab.
|
|
|
|
name: Cloud Frontend Preview Cleanup Dispatch
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed, unlabeled]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
dispatch:
|
|
# Only dispatch when:
|
|
# - PR closed AND had a preview label
|
|
# - Preview label specifically removed
|
|
if: >
|
|
github.repository == 'Comfy-Org/ComfyUI_frontend' &&
|
|
((github.event.action == 'closed' &&
|
|
(contains(github.event.pull_request.labels.*.name, 'preview') ||
|
|
contains(github.event.pull_request.labels.*.name, 'preview-cpu') ||
|
|
contains(github.event.pull_request.labels.*.name, 'preview-gpu'))) ||
|
|
(github.event.action == 'unlabeled' &&
|
|
contains(fromJSON('["preview","preview-cpu","preview-gpu"]'), github.event.label.name)))
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Dispatch to cloud repo
|
|
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
|
|
with:
|
|
token: ${{ secrets.CLOUD_DISPATCH_TOKEN }}
|
|
repository: Comfy-Org/cloud
|
|
event-type: frontend-preview-cleanup
|
|
client-payload: >-
|
|
{"pr_number": "${{ github.event.pull_request.number }}"}
|