Skip to content

Commit bd299b8

Browse files
[devex] Update hotfix release command to work with new automated backporting process (#5271)
* Update hotfix release command for modern automated backport workflow - Add Step 0 to check automated backport status first - Emphasize this command is fallback when automation fails - Add critical draft release publishing step (uncheck 'Set as latest') - Add ComfyUI requirements.txt PR creation with exact template - Update workflow context for modern automated backports * Restructure hotfix release command for modern workflow - Add clear process overview and context at top - Step 1: Try automated backports first (via labels) - Fallback to manual cherry-picking only if automation fails - Add critical draft release publishing step (uncheck 'Set as latest') - Add ComfyUI requirements.txt PR creation with exact template - Remove time estimates and reorganize for clarity - Update step numbering and cross-references * Enable backport automation for already-merged PRs - Add 'labeled' trigger to backport workflow - Allow backport automation when needs-backport label is added to merged PRs - Supports hotfix workflow where labels are added retroactively - Maintains existing behavior for PRs merged with labels already present * Prevent duplicate backport triggers with idempotency check - Add check for existing backport PRs before starting backport process - Skip backport work if PRs already exist for the same PR number - Prevents double execution when both 'labeled' and 'closed' events trigger - Maintains workflow reliability and avoids duplicate backport PRs * Add smart backport detection to hotfix command - Check for existing automated backport PRs and their status - Path A: Skip to version bump if backports already merged - Path B: Guide user to merge pending backport PRs first - Path C: Fall back to manual cherry-picking if no/failed automation - Add clear workflow path documentation for different scenarios * Add automated fork handling for ComfyUI requirements.txt PRs - Check if fork exists, create if needed - Clone fork to local ComfyUI-fork directory - Create branch, update requirements.txt with sed - Create PR from fork using gh CLI with exact template format - Handle both new and existing fork scenarios - Keep fork directory for future updates * [style] improve backport workflow logging and structure - Change ::notice to ::warning for existing backports per @DrJKL's feedback - Refactor conditional to use guard clause pattern per @DrJKL's suggestion - Improves readability and follows conventional shell scripting patterns Addresses @DrJKL's review comments in PR #5271
1 parent 687580e commit bd299b8

File tree

2 files changed

+218
-36
lines changed

2 files changed

+218
-36
lines changed

.claude/commands/create-hotfix-release.md

Lines changed: 194 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,85 @@
11
# Create Hotfix Release
22

3-
This command guides you through creating a patch/hotfix release for ComfyUI Frontend with comprehensive safety checks and human confirmations at each step.
3+
This command creates patch/hotfix releases for ComfyUI Frontend by backporting fixes to stable core branches. It handles both automated backports (preferred) and manual cherry-picking (fallback).
4+
5+
**Process Overview:**
6+
1. **Check automated backports first** (via labels)
7+
2. **Skip to version bump** if backports already merged
8+
3. **Manual cherry-picking** if automation failed
9+
4. **Create patch release** with version bump
10+
5. **Publish GitHub release** (manually uncheck "latest")
11+
6. **Update ComfyUI requirements.txt** via PR
412

513
<task>
6-
Create a hotfix release by cherry-picking commits or PR commits from main to a core branch: $ARGUMENTS
14+
Create a hotfix release by backporting commits/PRs from main to a core branch: $ARGUMENTS
715

816
Expected format: Comma-separated list of commits or PR numbers
917
Examples:
10-
- `abc123,def456,ghi789` (commits)
11-
- `#1234,#5678` (PRs)
12-
- `abc123,#1234,def456` (mixed)
18+
- `#1234,#5678` (PRs - preferred)
19+
- `abc123,def456` (commit hashes)
20+
- `#1234,abc123` (mixed)
1321

14-
If no arguments provided, the command will help identify the correct core branch and guide you through selecting commits/PRs.
22+
If no arguments provided, the command will guide you through identifying commits/PRs to backport.
1523
</task>
1624

1725
## Prerequisites
1826

19-
Before starting, ensure:
20-
- You have push access to the repository
21-
- GitHub CLI (`gh`) is authenticated
22-
- You're on a clean working tree
23-
- You understand the commits/PRs you're cherry-picking
27+
- Push access to repository
28+
- GitHub CLI (`gh`) authenticated
29+
- Clean working tree
30+
- Understanding of what fixes need backporting
2431

2532
## Hotfix Release Process
2633

27-
### Step 1: Identify Target Core Branch
34+
### Step 1: Try Automated Backports First
35+
36+
**Check if automated backports were attempted:**
37+
38+
1. **For each PR, check existing backport labels:**
39+
```bash
40+
gh pr view #1234 --json labels | jq -r '.labels[].name'
41+
```
42+
43+
2. **If no backport labels exist, add them now:**
44+
```bash
45+
# Add backport labels (this triggers automated backports)
46+
gh pr edit #1234 --add-label "needs-backport"
47+
gh pr edit #1234 --add-label "1.24" # Replace with target version
48+
```
49+
50+
3. **Check for existing backport PRs:**
51+
```bash
52+
# Check for backport PRs created by automation
53+
PR_NUMBER=${ARGUMENTS%%,*} # Extract first PR number from arguments
54+
PR_NUMBER=${PR_NUMBER#\#} # Remove # prefix
55+
gh pr list --search "backport-${PR_NUMBER}-to" --json number,title,state,baseRefName
56+
```
57+
58+
4. **Handle existing backport scenarios:**
59+
60+
**Scenario A: Automated backports already merged**
61+
```bash
62+
# Check if backport PRs were merged to core branches
63+
gh pr list --search "backport-${PR_NUMBER}-to" --state merged
64+
```
65+
- If backport PRs are merged → Skip to Step 10 (Version Bump)
66+
- **CONFIRMATION**: Automated backports completed, proceeding to version bump?
67+
68+
**Scenario B: Automated backport PRs exist but not merged**
69+
```bash
70+
# Show open backport PRs that need merging
71+
gh pr list --search "backport-${PR_NUMBER}-to" --state open
72+
```
73+
- **ACTION REQUIRED**: Merge the existing backport PRs first
74+
- Use: `gh pr merge [PR_NUMBER] --merge` for each backport PR
75+
- After merging, return to this command and skip to Step 10 (Version Bump)
76+
- **CONFIRMATION**: Have you merged all backport PRs? Ready to proceed to version bump?
77+
78+
**Scenario C: No automated backports or they failed**
79+
- Continue to Step 2 for manual cherry-picking
80+
- **CONFIRMATION**: Proceeding with manual cherry-picking because automation failed?
81+
82+
### Step 2: Identify Target Core Branch
2883

2984
1. Fetch the current ComfyUI requirements.txt from master branch:
3085
```bash
@@ -36,7 +91,7 @@ Before starting, ensure:
3691
5. Verify the core branch exists: `git ls-remote origin refs/heads/core/*`
3792
6. **CONFIRMATION REQUIRED**: Is `core/X.Y` the correct target branch?
3893

39-
### Step 2: Parse and Validate Arguments
94+
### Step 3: Parse and Validate Arguments
4095

4196
1. Parse the comma-separated list of commits/PRs
4297
2. For each item:
@@ -49,7 +104,7 @@ Before starting, ensure:
49104
- **CONFIRMATION REQUIRED**: Use merge commit or cherry-pick individual commits?
50105
4. Validate all commit hashes exist in the repository
51106

52-
### Step 3: Analyze Target Changes
107+
### Step 4: Analyze Target Changes
53108

54109
1. For each commit/PR to cherry-pick:
55110
- Display commit hash, author, date
@@ -60,7 +115,7 @@ Before starting, ensure:
60115
2. Identify potential conflicts by checking changed files
61116
3. **CONFIRMATION REQUIRED**: Proceed with these commits?
62117

63-
### Step 4: Create Hotfix Branch
118+
### Step 5: Create Hotfix Branch
64119

65120
1. Checkout the core branch (e.g., `core/1.23`)
66121
2. Pull latest changes: `git pull origin core/X.Y`
@@ -69,7 +124,7 @@ Before starting, ensure:
69124
- Example: `hotfix/1.23.4-20241120`
70125
5. **CONFIRMATION REQUIRED**: Created branch correctly?
71126

72-
### Step 5: Cherry-pick Changes
127+
### Step 6: Cherry-pick Changes
73128

74129
For each commit:
75130
1. Attempt cherry-pick: `git cherry-pick <commit>`
@@ -83,7 +138,7 @@ For each commit:
83138
- Run validation: `pnpm typecheck && pnpm lint`
84139
4. **CONFIRMATION REQUIRED**: Cherry-pick successful and valid?
85140

86-
### Step 6: Create PR to Core Branch
141+
### Step 7: Create PR to Core Branch
87142

88143
1. Push the hotfix branch: `git push origin hotfix/<version>-<timestamp>`
89144
2. Create PR using gh CLI:
@@ -100,7 +155,7 @@ For each commit:
100155
- Impact assessment
101156
5. **CONFIRMATION REQUIRED**: PR created correctly?
102157

103-
### Step 7: Wait for Tests
158+
### Step 8: Wait for Tests
104159

105160
1. Monitor PR checks: `gh pr checks`
106161
2. Display test results as they complete
@@ -111,15 +166,15 @@ For each commit:
111166
4. Wait for all required checks to pass
112167
5. **CONFIRMATION REQUIRED**: All tests passing?
113168

114-
### Step 8: Merge Hotfix PR
169+
### Step 9: Merge Hotfix PR
115170

116171
1. Verify all checks have passed
117172
2. Check for required approvals
118173
3. Merge the PR: `gh pr merge --merge`
119174
4. Delete the hotfix branch
120175
5. **CONFIRMATION REQUIRED**: PR merged successfully?
121176

122-
### Step 9: Create Version Bump
177+
### Step 10: Create Version Bump
123178

124179
1. Checkout the core branch: `git checkout core/X.Y`
125180
2. Pull latest changes: `git pull origin core/X.Y`
@@ -131,7 +186,7 @@ For each commit:
131186
7. Commit: `git commit -m "[release] Bump version to 1.23.5"`
132187
8. **CONFIRMATION REQUIRED**: Version bump correct?
133188

134-
### Step 10: Create Release PR
189+
### Step 11: Create Release PR
135190

136191
1. Push release branch: `git push origin release/1.23.5`
137192
2. Create PR with Release label:
@@ -184,7 +239,7 @@ For each commit:
184239
```
185240
5. **CONFIRMATION REQUIRED**: Release PR has "Release" label?
186241
187-
### Step 11: Monitor Release Process
242+
### Step 12: Monitor Release Process
188243
189244
1. Wait for PR checks to pass
190245
2. **FINAL CONFIRMATION**: Ready to trigger release by merging?
@@ -199,7 +254,102 @@ For each commit:
199254
- PyPI upload
200255
- pnpm types publication
201256
202-
### Step 12: Post-Release Verification
257+
### Step 13: Manually Publish Draft Release
258+
259+
**CRITICAL**: The release workflow creates a DRAFT release. You must manually publish it:
260+
261+
1. **Go to GitHub Releases:** https://github.com/Comfy-Org/ComfyUI_frontend/releases
262+
2. **Find the DRAFT release** (e.g., "v1.23.5 Draft")
263+
3. **Click "Edit release"**
264+
4. **UNCHECK "Set as the latest release"** ⚠️ **CRITICAL**
265+
- This prevents the hotfix from showing as "latest"
266+
- Main branch should always be "latest release"
267+
5. **Click "Publish release"**
268+
6. **CONFIRMATION REQUIRED**: Draft release published with "latest" unchecked?
269+
270+
### Step 14: Create ComfyUI Requirements.txt Update PR
271+
272+
**IMPORTANT**: Create PR to update ComfyUI's requirements.txt via fork:
273+
274+
1. **Setup fork (if needed):**
275+
```bash
276+
# Check if fork already exists
277+
if gh repo view ComfyUI --json owner | jq -r '.owner.login' | grep -q "$(gh api user --jq .login)"; then
278+
echo "Fork already exists"
279+
else
280+
# Fork the ComfyUI repository
281+
gh repo fork comfyanonymous/ComfyUI --clone=false
282+
echo "Created fork of ComfyUI"
283+
fi
284+
```
285+
286+
2. **Clone fork and create branch:**
287+
```bash
288+
# Clone your fork (or use existing clone)
289+
GITHUB_USER=$(gh api user --jq .login)
290+
if [ ! -d "ComfyUI-fork" ]; then
291+
gh repo clone ${GITHUB_USER}/ComfyUI ComfyUI-fork
292+
fi
293+
294+
cd ComfyUI-fork
295+
git checkout master
296+
git pull origin master
297+
298+
# Create update branch
299+
BRANCH_NAME="update-frontend-${NEW_VERSION}"
300+
git checkout -b ${BRANCH_NAME}
301+
```
302+
303+
3. **Update requirements.txt:**
304+
```bash
305+
# Update the version in requirements.txt
306+
sed -i "s/comfyui-frontend-package==[0-9].*$/comfyui-frontend-package==${NEW_VERSION}/" requirements.txt
307+
308+
# Verify the change
309+
grep "comfyui-frontend-package" requirements.txt
310+
311+
# Commit the change
312+
git add requirements.txt
313+
git commit -m "Bump frontend to ${NEW_VERSION}"
314+
git push origin ${BRANCH_NAME}
315+
```
316+
317+
4. **Create PR from fork:**
318+
```bash
319+
# Create PR using gh CLI from fork
320+
gh pr create \
321+
--repo comfyanonymous/ComfyUI \
322+
--title "Bump frontend to ${NEW_VERSION}" \
323+
--body "$(cat <<EOF
324+
Bump frontend to ${NEW_VERSION}
325+
326+
\`\`\`
327+
python main.py --front-end-version Comfy-Org/ComfyUI_frontend@${NEW_VERSION}
328+
\`\`\`
329+
330+
- Diff: [Comfy-Org/ComfyUI_frontend: v${OLD_VERSION}...v${NEW_VERSION}](https://github.com/Comfy-Org/ComfyUI_frontend/compare/v${OLD_VERSION}...v${NEW_VERSION})
331+
- PyPI Package: https://pypi.org/project/comfyui-frontend-package/${NEW_VERSION}/
332+
- npm Types: https://www.npmjs.com/package/@comfyorg/comfyui-frontend-types/v/${NEW_VERSION}
333+
334+
## Changes
335+
336+
- Fix: [Brief description of hotfixes included]
337+
EOF
338+
)"
339+
```
340+
341+
5. **Clean up:**
342+
```bash
343+
# Return to original directory
344+
cd ..
345+
346+
# Keep fork directory for future updates
347+
echo "Fork directory 'ComfyUI-fork' kept for future use"
348+
```
349+
350+
6. **CONFIRMATION REQUIRED**: ComfyUI requirements.txt PR created from fork?
351+
352+
### Step 15: Post-Release Verification
203353
204354
1. Verify GitHub release:
205355
```bash
@@ -213,12 +363,14 @@ For each commit:
213363
```bash
214364
pnpm view @comfyorg/[email protected]
215365
```
216-
4. Generate release summary with:
366+
4. Monitor ComfyUI requirements.txt PR for approval/merge
367+
5. Generate release summary with:
217368
- Version released
218369
- Commits included
219370
- Issues fixed
220371
- Distribution status
221-
5. **CONFIRMATION REQUIRED**: Release completed successfully?
372+
- ComfyUI integration status
373+
6. **CONFIRMATION REQUIRED**: Hotfix release fully completed?
222374
223375
## Safety Checks
224376
@@ -240,19 +392,28 @@ If something goes wrong:
240392
241393
## Important Notes
242394
395+
- **Always try automated backports first** - This command is for when automation fails
243396
- Core branch version will be behind main - this is expected
244397
- The "Release" label triggers the PyPI/npm publication
398+
- **CRITICAL**: Always uncheck "Set as latest release" for hotfix releases
399+
- **Must create ComfyUI requirements.txt PR** - Hotfix isn't complete without it
245400
- PR numbers must include the `#` prefix
246401
- Mixed commits/PRs are supported but review carefully
247402
- Always wait for full test suite before proceeding
248403
249-
## Expected Timeline
404+
## Modern Workflow Context
405+
406+
**Primary Backport Method:** Automated via `needs-backport` + `X.YY` labels
407+
**This Command Usage:**
408+
- Smart path detection - skip to version bump if backports already merged
409+
- Fallback to manual cherry-picking only when automation fails/has conflicts
410+
**Complete Hotfix:** Includes GitHub release publishing + ComfyUI requirements.txt integration
411+
412+
## Workflow Paths
413+
414+
- **Path A:** Backports already merged → Skip to Step 10 (Version Bump)
415+
- **Path B:** Backport PRs need merging → Merge them → Skip to Step 10 (Version Bump)
416+
- **Path C:** No/failed backports → Manual cherry-picking (Steps 2-9) → Version Bump (Step 10)
250417
251-
- Step 1-3: ~10 minutes (analysis)
252-
- Steps 4-6: ~15-30 minutes (cherry-picking)
253-
- Step 7: ~10-20 minutes (tests)
254-
- Steps 8-10: ~10 minutes (version bump)
255-
- Step 11-12: ~15-20 minutes (release)
256-
- Total: ~60-90 minutes
257418
258-
This process ensures a safe, verified hotfix release with multiple confirmation points and clear tracking of what changes are being released.
419+
This process ensures a complete hotfix release with proper GitHub publishing, ComfyUI integration, and multiple safety checkpoints.

0 commit comments

Comments
 (0)