mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
- Add CI workflow to build and deploy to comfy-ui.pages.dev on every push/PR - Add deploy script with auto PR comments following storybook pattern - Add ConnectionPanelView at /connect with backend URL config, HTTP/WS test, CLI guide, build info - Inject CI metadata (branch, PR#, run ID, job ID) as build-time defines - Add i18n strings, route, unit tests (8/8 passing) Amp-Thread-ID: https://ampcode.com/threads/T-019d7738-d170-7409-8699-23a55d8ad5e7 Co-authored-by: Amp <amp@ampcode.com>
138 lines
4.3 KiB
YAML
138 lines
4.3 KiB
YAML
# Description: Builds ComfyUI frontend and deploys previews to Cloudflare Pages
|
|
name: 'CI: Deploy Preview'
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Post starting comment for non-forked PRs
|
|
comment-on-pr-start:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Post starting comment
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: |
|
|
chmod +x scripts/cicd/pr-preview-deploy-and-comment.sh
|
|
./scripts/cicd/pr-preview-deploy-and-comment.sh \
|
|
"${{ github.event.pull_request.number }}" \
|
|
"${{ github.head_ref }}" \
|
|
"starting"
|
|
|
|
# Build frontend for all PRs and pushes
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
conclusion: ${{ steps.job-status.outputs.conclusion }}
|
|
workflow-url: ${{ steps.workflow-url.outputs.url }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup frontend
|
|
uses: ./.github/actions/setup-frontend
|
|
|
|
- name: Build frontend
|
|
env:
|
|
FRONTEND_COMMIT_HASH: ${{ github.sha }}
|
|
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
|
|
CI_PR_NUMBER: ${{ github.event.pull_request.number || '' }}
|
|
CI_RUN_ID: ${{ github.run_id }}
|
|
CI_JOB_ID: ${{ github.job }}
|
|
run: pnpm build
|
|
|
|
- name: Set job status
|
|
id: job-status
|
|
if: always()
|
|
run: |
|
|
echo "conclusion=${{ job.status }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get workflow URL
|
|
id: workflow-url
|
|
if: always()
|
|
run: |
|
|
echo "url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload build artifact
|
|
if: success() && github.event.pull_request.head.repo.fork == false
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
retention-days: 7
|
|
|
|
# Deploy and comment for non-forked PRs only
|
|
deploy-and-comment:
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && always()
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Download build artifact
|
|
if: needs.build.outputs.conclusion == 'success'
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
|
|
- name: Make deployment script executable
|
|
run: chmod +x scripts/cicd/pr-preview-deploy-and-comment.sh
|
|
|
|
- name: Deploy preview and comment on PR
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
WORKFLOW_CONCLUSION: ${{ needs.build.outputs.conclusion }}
|
|
WORKFLOW_URL: ${{ needs.build.outputs.workflow-url }}
|
|
run: |
|
|
./scripts/cicd/pr-preview-deploy-and-comment.sh \
|
|
"${{ github.event.pull_request.number }}" \
|
|
"${{ github.head_ref }}" \
|
|
"completed"
|
|
|
|
# Deploy to production URL on main branch push
|
|
deploy-production:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup frontend
|
|
uses: ./.github/actions/setup-frontend
|
|
|
|
- name: Build frontend
|
|
env:
|
|
FRONTEND_COMMIT_HASH: ${{ github.sha }}
|
|
CI_BRANCH: ${{ github.ref_name }}
|
|
CI_RUN_ID: ${{ github.run_id }}
|
|
CI_JOB_ID: ${{ github.job }}
|
|
run: pnpm build
|
|
|
|
- name: Deploy to Cloudflare Pages (production)
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
run: |
|
|
npx wrangler@^4.0.0 pages deploy dist \
|
|
--project-name=comfy-ui \
|
|
--branch=main
|