Skip to content

Commit 7a6cc39

Browse files
[feat] Add weekly ComfyUI release automation (#6877)
Adds scheduled workflow to bump ComfyUI frontend RC releases every Monday at noon PST. ## Implementation - **Resolver script** (`scripts/cicd/resolve-comfyui-release.ts`): Checks ComfyUI `requirements.txt` and determines next minor version, compares branch commits to latest patch tag - **Workflow** (`.github/workflows/weekly-comfyui-release.yaml`): - Scheduled for Monday 20:00 UTC (noon PST) - Manual dispatch supported for testing/off-cycle runs - Three jobs: resolve version → trigger release if needed → create ComfyUI PR - Reuses existing `release-version-bump.yaml` workflow - Creates draft PR from fork to `comfyanonymous/ComfyUI` with updated `requirements.txt` - Includes error handling and validation for all steps - Force pushes to same branch weekly to maintain single open PR ## Testing - Resolver script tested locally: correctly identified v1.28.8 → v1.29.4 with release needed - yamllint passes - knip passes with `gh` binary added to ignore list ## Follow-up Can test via workflow_dispatch once merged, or in this PR if we enable Actions on branch. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6877-feat-Add-weekly-ComfyUI-release-automation-2b46d73d36508154aa05c783c6942d9a) by [Unito](https://www.unito.io)
1 parent 2b75120 commit 7a6cc39

File tree

3 files changed

+525
-1
lines changed

3 files changed

+525
-1
lines changed
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
# Automated weekly workflow to bump ComfyUI frontend RC releases
2+
name: "Weekly ComfyUI Release"
3+
4+
on:
5+
# Schedule for Monday at 12:00 PM PST (20:00 UTC)
6+
schedule:
7+
- cron: '0 20 * * 1'
8+
9+
# Allow manual triggering
10+
workflow_dispatch:
11+
inputs:
12+
comfyui_fork:
13+
description: 'ComfyUI fork to use for PR (e.g., Comfy-Org/ComfyUI)'
14+
required: false
15+
default: 'Comfy-Org/ComfyUI'
16+
type: string
17+
18+
jobs:
19+
resolve-version:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
current_version: ${{ steps.resolve.outputs.current_version }}
23+
target_version: ${{ steps.resolve.outputs.target_version }}
24+
target_minor: ${{ steps.resolve.outputs.target_minor }}
25+
target_branch: ${{ steps.resolve.outputs.target_branch }}
26+
needs_release: ${{ steps.resolve.outputs.needs_release }}
27+
diff_url: ${{ steps.resolve.outputs.diff_url }}
28+
latest_patch_tag: ${{ steps.resolve.outputs.latest_patch_tag }}
29+
30+
steps:
31+
- name: Checkout ComfyUI_frontend
32+
uses: actions/checkout@v5
33+
with:
34+
fetch-depth: 0
35+
path: frontend
36+
37+
- name: Checkout ComfyUI (sparse)
38+
uses: actions/checkout@v5
39+
with:
40+
repository: comfyanonymous/ComfyUI
41+
sparse-checkout: |
42+
requirements.txt
43+
path: comfyui
44+
45+
- name: Install pnpm
46+
uses: pnpm/action-setup@v4
47+
with:
48+
version: 10
49+
50+
- name: Setup Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: lts/*
54+
55+
- name: Install dependencies
56+
working-directory: frontend
57+
run: pnpm install --frozen-lockfile
58+
59+
- name: Resolve release information
60+
id: resolve
61+
working-directory: frontend
62+
run: |
63+
set -euo pipefail
64+
65+
# Run the resolver script
66+
if ! RESULT=$(tsx scripts/cicd/resolve-comfyui-release.ts ../comfyui .); then
67+
echo "Failed to resolve release information"
68+
exit 1
69+
fi
70+
71+
echo "Resolver output:"
72+
echo "$RESULT"
73+
74+
# Validate JSON output
75+
if ! echo "$RESULT" | jq empty 2>/dev/null; then
76+
echo "Invalid JSON output from resolver"
77+
exit 1
78+
fi
79+
80+
# Parse JSON output and set outputs
81+
echo "current_version=$(echo "$RESULT" | jq -r '.current_version')" >> $GITHUB_OUTPUT
82+
echo "target_version=$(echo "$RESULT" | jq -r '.target_version')" >> $GITHUB_OUTPUT
83+
echo "target_minor=$(echo "$RESULT" | jq -r '.target_minor')" >> $GITHUB_OUTPUT
84+
echo "target_branch=$(echo "$RESULT" | jq -r '.target_branch')" >> $GITHUB_OUTPUT
85+
echo "needs_release=$(echo "$RESULT" | jq -r '.needs_release')" >> $GITHUB_OUTPUT
86+
echo "diff_url=$(echo "$RESULT" | jq -r '.diff_url')" >> $GITHUB_OUTPUT
87+
echo "latest_patch_tag=$(echo "$RESULT" | jq -r '.latest_patch_tag')" >> $GITHUB_OUTPUT
88+
89+
- name: Summary
90+
run: |
91+
echo "## Release Information" >> $GITHUB_STEP_SUMMARY
92+
echo "" >> $GITHUB_STEP_SUMMARY
93+
echo "- Current version: ${{ steps.resolve.outputs.current_version }}" >> $GITHUB_STEP_SUMMARY
94+
echo "- Target version: ${{ steps.resolve.outputs.target_version }}" >> $GITHUB_STEP_SUMMARY
95+
echo "- Target branch: ${{ steps.resolve.outputs.target_branch }}" >> $GITHUB_STEP_SUMMARY
96+
echo "- Needs release: ${{ steps.resolve.outputs.needs_release }}" >> $GITHUB_STEP_SUMMARY
97+
echo "- Diff: [${{ steps.resolve.outputs.current_version }}...${{ steps.resolve.outputs.target_version }}](${{ steps.resolve.outputs.diff_url }})" >> $GITHUB_STEP_SUMMARY
98+
99+
trigger-release-if-needed:
100+
needs: resolve-version
101+
if: needs.resolve-version.outputs.needs_release == 'true'
102+
runs-on: ubuntu-latest
103+
104+
steps:
105+
- name: Trigger release workflow
106+
env:
107+
GH_TOKEN: ${{ secrets.PR_GH_TOKEN }}
108+
run: |
109+
set -euo pipefail
110+
111+
echo "Triggering release workflow for branch ${{ needs.resolve-version.outputs.target_branch }}"
112+
113+
# Trigger the release-version-bump workflow
114+
if ! gh workflow run release-version-bump.yaml \
115+
--repo Comfy-Org/ComfyUI_frontend \
116+
--ref main \
117+
--field version_type=patch \
118+
--field branch=${{ needs.resolve-version.outputs.target_branch }}; then
119+
echo "Failed to trigger release workflow"
120+
exit 1
121+
fi
122+
123+
echo "Release workflow triggered successfully for ${{ needs.resolve-version.outputs.target_branch }}"
124+
125+
- name: Summary
126+
run: |
127+
echo "## Release Workflow Triggered" >> $GITHUB_STEP_SUMMARY
128+
echo "" >> $GITHUB_STEP_SUMMARY
129+
echo "- Branch: ${{ needs.resolve-version.outputs.target_branch }}" >> $GITHUB_STEP_SUMMARY
130+
echo "- Target version: ${{ needs.resolve-version.outputs.target_version }}" >> $GITHUB_STEP_SUMMARY
131+
echo "- [View workflow runs](https://github.com/Comfy-Org/ComfyUI_frontend/actions/workflows/release-version-bump.yaml)" >> $GITHUB_STEP_SUMMARY
132+
133+
create-comfyui-pr:
134+
needs: [resolve-version, trigger-release-if-needed]
135+
if: always() && needs.resolve-version.result == 'success'
136+
runs-on: ubuntu-latest
137+
138+
steps:
139+
- name: Checkout ComfyUI fork
140+
uses: actions/checkout@v5
141+
with:
142+
repository: ${{ inputs.comfyui_fork || 'Comfy-Org/ComfyUI' }}
143+
token: ${{ secrets.PR_GH_TOKEN }}
144+
path: comfyui
145+
146+
- name: Update requirements.txt
147+
working-directory: comfyui
148+
run: |
149+
set -euo pipefail
150+
151+
TARGET_VERSION="${{ needs.resolve-version.outputs.target_version }}"
152+
echo "Updating comfyui-frontend-package to ${TARGET_VERSION}"
153+
154+
# Update the comfyui-frontend-package version (POSIX-compatible)
155+
sed -i.bak "s/comfyui-frontend-package==[0-9.][0-9.]*/comfyui-frontend-package==${TARGET_VERSION}/" requirements.txt
156+
rm requirements.txt.bak
157+
158+
# Verify the change was made
159+
if ! grep -q "comfyui-frontend-package==${TARGET_VERSION}" requirements.txt; then
160+
echo "Failed to update requirements.txt"
161+
exit 1
162+
fi
163+
164+
echo "Updated requirements.txt:"
165+
grep comfyui-frontend-package requirements.txt
166+
167+
- name: Build PR description
168+
id: pr-body
169+
run: |
170+
BODY=$(cat <<'EOF'
171+
Bumps frontend to ${{ needs.resolve-version.outputs.target_version }}
172+
173+
Test quickly:
174+
175+
```bash
176+
python main.py --front-end-version Comfy-Org/ComfyUI_frontend@${{ needs.resolve-version.outputs.target_version }}
177+
```
178+
179+
- Diff: [v${{ needs.resolve-version.outputs.current_version }}...v${{ needs.resolve-version.outputs.target_version }}](${{ needs.resolve-version.outputs.diff_url }})
180+
- PyPI: https://pypi.org/project/comfyui-frontend-package/${{ needs.resolve-version.outputs.target_version }}/
181+
- npm: https://www.npmjs.com/package/@comfyorg/comfyui-frontend-types/v/${{ needs.resolve-version.outputs.target_version }}
182+
EOF
183+
)
184+
185+
# Add release PR note if release was triggered
186+
if [ "${{ needs.resolve-version.outputs.needs_release }}" = "true" ]; then
187+
RELEASE_NOTE="⚠️ **Release PR must be merged first** - check [release workflow runs](https://github.com/Comfy-Org/ComfyUI_frontend/actions/workflows/release-version-bump.yaml)"
188+
BODY=$''"${RELEASE_NOTE}"$'\n\n'"${BODY}"
189+
fi
190+
191+
# Save to file for later use
192+
printf '%s\n' "$BODY" > pr-body.txt
193+
cat pr-body.txt
194+
195+
- name: Create PR to ComfyUI
196+
working-directory: comfyui
197+
env:
198+
GH_TOKEN: ${{ secrets.PR_GH_TOKEN }}
199+
COMFYUI_FORK: ${{ inputs.comfyui_fork || 'Comfy-Org/ComfyUI' }}
200+
run: |
201+
set -euo pipefail
202+
203+
# Extract fork owner from repository name
204+
FORK_OWNER=$(echo "$COMFYUI_FORK" | cut -d'/' -f1)
205+
206+
echo "Creating PR from ${COMFYUI_FORK} to comfyanonymous/ComfyUI"
207+
208+
# Configure git
209+
git config user.name "github-actions[bot]"
210+
git config user.email "github-actions[bot]@users.noreply.github.com"
211+
212+
# Create/update branch (reuse same branch name each week)
213+
BRANCH="automation/comfyui-frontend-bump"
214+
git checkout -B "$BRANCH"
215+
git add requirements.txt
216+
217+
if ! git diff --cached --quiet; then
218+
git commit -m "Bump comfyui-frontend-package to ${{ needs.resolve-version.outputs.target_version }}"
219+
else
220+
echo "No changes to commit"
221+
exit 0
222+
fi
223+
224+
# Force push to fork (overwrites previous week's branch)
225+
# Note: This intentionally destroys branch history to maintain a single PR
226+
# Any review comments or manual commits will need to be re-applied
227+
if ! git push -f origin "$BRANCH"; then
228+
echo "Failed to push branch to fork"
229+
exit 1
230+
fi
231+
232+
# Create draft PR from fork to upstream
233+
PR_BODY=$(cat ../pr-body.txt)
234+
235+
# Try to create PR, ignore error if it already exists
236+
if ! gh pr create \
237+
--repo comfyanonymous/ComfyUI \
238+
--head "${FORK_OWNER}:${BRANCH}" \
239+
--base master \
240+
--title "Bump comfyui-frontend-package to ${{ needs.resolve-version.outputs.target_version }}" \
241+
--body "$PR_BODY" \
242+
--draft 2>&1; then
243+
244+
# Check if PR already exists
245+
set +e
246+
EXISTING_PR=$(gh pr list --repo comfyanonymous/ComfyUI --head "${FORK_OWNER}:${BRANCH}" --json number --jq '.[0].number' 2>&1)
247+
PR_LIST_EXIT=$?
248+
set -e
249+
250+
if [ $PR_LIST_EXIT -ne 0 ]; then
251+
echo "Failed to check for existing PR: $EXISTING_PR"
252+
exit 1
253+
fi
254+
255+
if [ -n "$EXISTING_PR" ] && [ "$EXISTING_PR" != "null" ]; then
256+
echo "PR already exists (#${EXISTING_PR}), updating branch will update the PR"
257+
else
258+
echo "Failed to create PR and no existing PR found"
259+
exit 1
260+
fi
261+
fi
262+
263+
- name: Summary
264+
run: |
265+
echo "## ComfyUI PR Created" >> $GITHUB_STEP_SUMMARY
266+
echo "" >> $GITHUB_STEP_SUMMARY
267+
echo "Draft PR created in comfyanonymous/ComfyUI" >> $GITHUB_STEP_SUMMARY
268+
echo "" >> $GITHUB_STEP_SUMMARY
269+
echo "### PR Body:" >> $GITHUB_STEP_SUMMARY
270+
cat pr-body.txt >> $GITHUB_STEP_SUMMARY

knip.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const config: KnipConfig = {
2727
project: ['src/**/*.{js,ts}']
2828
}
2929
},
30-
ignoreBinaries: ['python3'],
30+
ignoreBinaries: ['python3', 'gh'],
3131
ignoreDependencies: [
3232
// Weird importmap things
3333
'@iconify/json',

0 commit comments

Comments
 (0)