mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
ci: automate cloud release branch tagging (#6321)
Changes the RC minor version branch release automation to create paired `core/x.y` and `cloud/x.y` branches whenever a release bump merges. Then changes the backport workflow to accept labels that match those branch names directly, allowing engineers to route fixes to either OSS or cloud release lines without extra labels or artifacts. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6321-ci-automate-cloud-release-branch-tagging-2996d73d365081b0b036ebd3f088354b) by [Unito](https://www.unito.io)
This commit is contained in:
8
.github/workflows/pr-backport.yaml
vendored
8
.github/workflows/pr-backport.yaml
vendored
@@ -111,6 +111,14 @@ jobs:
|
|||||||
add_target "$label" "${BASH_REMATCH[1]}"
|
add_target "$label" "${BASH_REMATCH[1]}"
|
||||||
elif [[ "$label" =~ ^backport:(.+)$ ]]; then
|
elif [[ "$label" =~ ^backport:(.+)$ ]]; then
|
||||||
add_target "$label" "${BASH_REMATCH[1]}"
|
add_target "$label" "${BASH_REMATCH[1]}"
|
||||||
|
elif [[ "$label" =~ ^core\/([0-9]+)\.([0-9]+)$ ]]; then
|
||||||
|
SAFE_MAJOR="${BASH_REMATCH[1]}"
|
||||||
|
SAFE_MINOR="${BASH_REMATCH[2]}"
|
||||||
|
add_target "$label" "core/${SAFE_MAJOR}.${SAFE_MINOR}"
|
||||||
|
elif [[ "$label" =~ ^cloud\/([0-9]+)\.([0-9]+)$ ]]; then
|
||||||
|
SAFE_MAJOR="${BASH_REMATCH[1]}"
|
||||||
|
SAFE_MINOR="${BASH_REMATCH[2]}"
|
||||||
|
add_target "$label" "cloud/${SAFE_MAJOR}.${SAFE_MINOR}"
|
||||||
elif [[ "$label" =~ ^[0-9]+\.[0-9]+$ ]]; then
|
elif [[ "$label" =~ ^[0-9]+\.[0-9]+$ ]]; then
|
||||||
add_target "$label" "core/${label}"
|
add_target "$label" "core/${label}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
118
.github/workflows/release-branch-create.yaml
vendored
118
.github/workflows/release-branch-create.yaml
vendored
@@ -69,6 +69,9 @@ jobs:
|
|||||||
echo "prev_version=$PREV_VERSION" >> $GITHUB_OUTPUT
|
echo "prev_version=$PREV_VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "prev_minor=$PREV_MINOR" >> $GITHUB_OUTPUT
|
echo "prev_minor=$PREV_MINOR" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
BASE_COMMIT=$(git rev-parse HEAD)
|
||||||
|
echo "base_commit=$BASE_COMMIT" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Get previous major version for comparison
|
# Get previous major version for comparison
|
||||||
PREV_MAJOR=$(echo $PREV_VERSION | cut -d. -f1)
|
PREV_MAJOR=$(echo $PREV_VERSION | cut -d. -f1)
|
||||||
|
|
||||||
@@ -87,13 +90,13 @@ jobs:
|
|||||||
elif [[ "$MAJOR" -gt "$PREV_MAJOR" && "$MINOR" == "0" && "$PATCH" == "0" ]]; then
|
elif [[ "$MAJOR" -gt "$PREV_MAJOR" && "$MINOR" == "0" && "$PATCH" == "0" ]]; then
|
||||||
# Major version bump (e.g., 1.99.x → 2.0.0)
|
# Major version bump (e.g., 1.99.x → 2.0.0)
|
||||||
echo "is_minor_bump=true" >> $GITHUB_OUTPUT
|
echo "is_minor_bump=true" >> $GITHUB_OUTPUT
|
||||||
BRANCH_NAME="core/${PREV_MAJOR}.${PREV_MINOR}"
|
BRANCH_BASE="${PREV_MAJOR}.${PREV_MINOR}"
|
||||||
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
echo "branch_base=$BRANCH_BASE" >> $GITHUB_OUTPUT
|
||||||
elif [[ "$MAJOR" == "$PREV_MAJOR" && "$MINOR" -gt "$PREV_MINOR" && "$PATCH" == "0" ]]; then
|
elif [[ "$MAJOR" == "$PREV_MAJOR" && "$MINOR" -gt "$PREV_MINOR" && "$PATCH" == "0" ]]; then
|
||||||
# Minor version bump (e.g., 1.23.x → 1.24.0)
|
# Minor version bump (e.g., 1.23.x → 1.24.0)
|
||||||
echo "is_minor_bump=true" >> $GITHUB_OUTPUT
|
echo "is_minor_bump=true" >> $GITHUB_OUTPUT
|
||||||
BRANCH_NAME="core/${MAJOR}.${PREV_MINOR}"
|
BRANCH_BASE="${MAJOR}.${PREV_MINOR}"
|
||||||
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
echo "branch_base=$BRANCH_BASE" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "is_minor_bump=false" >> $GITHUB_OUTPUT
|
echo "is_minor_bump=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
@@ -101,64 +104,97 @@ jobs:
|
|||||||
# Return to main branch
|
# Return to main branch
|
||||||
git checkout main
|
git checkout main
|
||||||
|
|
||||||
- name: Create release branch
|
- name: Create release branches
|
||||||
|
id: create_branches
|
||||||
if: steps.check_version.outputs.is_minor_bump == 'true'
|
if: steps.check_version.outputs.is_minor_bump == 'true'
|
||||||
run: |
|
run: |
|
||||||
BRANCH_NAME="${{ steps.check_version.outputs.branch_name }}"
|
BRANCH_BASE="${{ steps.check_version.outputs.branch_base }}"
|
||||||
|
PREV_VERSION="${{ steps.check_version.outputs.prev_version }}"
|
||||||
|
|
||||||
# Check if branch already exists
|
if [[ -z "$BRANCH_BASE" ]]; then
|
||||||
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
|
echo "::error::Branch base not set; unable to determine release branches"
|
||||||
echo "⚠️ Branch $BRANCH_NAME already exists, skipping creation"
|
exit 1
|
||||||
echo "branch_exists=true" >> $GITHUB_ENV
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "branch_exists=false" >> $GITHUB_ENV
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create branch from the commit BEFORE the version bump
|
BASE_COMMIT="${{ steps.check_version.outputs.base_commit }}"
|
||||||
# This ensures the release branch has the previous minor version
|
|
||||||
git checkout -b "$BRANCH_NAME" HEAD^1
|
|
||||||
|
|
||||||
# Push the new branch
|
if [[ -z "$BASE_COMMIT" ]]; then
|
||||||
git push origin "$BRANCH_NAME"
|
echo "::error::Base commit not provided; cannot create release branches"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "✅ Created release branch: $BRANCH_NAME"
|
RESULTS_FILE=$(mktemp)
|
||||||
echo "This branch is now in feature freeze and will only receive:"
|
trap 'rm -f "$RESULTS_FILE"' EXIT
|
||||||
echo "- Bug fixes"
|
|
||||||
echo "- Critical security patches"
|
|
||||||
echo "- Documentation updates"
|
|
||||||
|
|
||||||
|
for PREFIX in core cloud; do
|
||||||
|
BRANCH_NAME="${PREFIX}/${BRANCH_BASE}"
|
||||||
|
|
||||||
|
if git ls-remote --exit-code --heads origin \
|
||||||
|
"$BRANCH_NAME" >/dev/null 2>&1; then
|
||||||
|
echo "⚠️ Branch $BRANCH_NAME already exists"
|
||||||
|
echo "ℹ️ Skipping creation for $BRANCH_NAME"
|
||||||
|
STATUS="exists"
|
||||||
|
else
|
||||||
|
# Create branch from the commit BEFORE the version bump
|
||||||
|
if ! git push origin "$BASE_COMMIT:refs/heads/$BRANCH_NAME"; then
|
||||||
|
echo "::error::Failed to push release branch $BRANCH_NAME"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Created release branch: $BRANCH_NAME"
|
||||||
|
STATUS="created"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$BRANCH_NAME|$STATUS|$PREV_VERSION" >> "$RESULTS_FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "results<<'EOF'"
|
||||||
|
cat "$RESULTS_FILE"
|
||||||
|
echo "EOF"
|
||||||
|
} >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Post summary
|
- name: Post summary
|
||||||
if: steps.check_version.outputs.is_minor_bump == 'true'
|
if: steps.check_version.outputs.is_minor_bump == 'true'
|
||||||
run: |
|
run: |
|
||||||
BRANCH_NAME="${{ steps.check_version.outputs.branch_name }}"
|
|
||||||
PREV_VERSION="${{ steps.check_version.outputs.prev_version }}"
|
|
||||||
CURRENT_VERSION="${{ steps.check_version.outputs.current_version }}"
|
CURRENT_VERSION="${{ steps.check_version.outputs.current_version }}"
|
||||||
|
RESULTS="${{ steps.create_branches.outputs.results }}"
|
||||||
|
|
||||||
if [[ "${{ env.branch_exists }}" == "true" ]]; then
|
if [[ -z "$RESULTS" ]]; then
|
||||||
cat >> $GITHUB_STEP_SUMMARY << EOF
|
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||||
## 🌿 Release Branch Already Exists
|
## 🌿 Release Branch Summary
|
||||||
|
|
||||||
The release branch for the previous minor version already exists:
|
Release branch creation skipped; no eligible branches were found.
|
||||||
EOF
|
|
||||||
else
|
|
||||||
cat >> $GITHUB_STEP_SUMMARY << EOF
|
|
||||||
## 🌿 Release Branch Created
|
|
||||||
|
|
||||||
A new release branch has been created for the previous minor version:
|
|
||||||
EOF
|
EOF
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >> $GITHUB_STEP_SUMMARY << EOF
|
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||||
|
## 🌿 Release Branch Summary
|
||||||
|
|
||||||
- **Branch**: \`$BRANCH_NAME\`
|
|
||||||
- **Version**: \`$PREV_VERSION\` (feature frozen)
|
|
||||||
- **Main branch**: \`$CURRENT_VERSION\` (active development)
|
- **Main branch**: \`$CURRENT_VERSION\` (active development)
|
||||||
|
|
||||||
|
### Branch Status
|
||||||
|
EOF
|
||||||
|
|
||||||
|
while IFS='|' read -r BRANCH STATUS PREV_VERSION; do
|
||||||
|
if [[ "$STATUS" == "created" ]]; then
|
||||||
|
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||||
|
|
||||||
|
- \`$BRANCH\` created from version \`$PREV_VERSION\`
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||||
|
|
||||||
|
- \`$BRANCH\` already existed (based on version \`$PREV_VERSION\`)
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
done <<< "$RESULTS"
|
||||||
|
|
||||||
|
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||||
|
|
||||||
### Branch Policy
|
### Branch Policy
|
||||||
|
|
||||||
The \`$BRANCH_NAME\` branch is now in **feature freeze** and will only accept:
|
Release branches are feature-frozen and only accept:
|
||||||
- 🐛 Bug fixes
|
- 🐛 Bug fixes
|
||||||
- 🔒 Security patches
|
- 🔒 Security patches
|
||||||
- 📚 Documentation updates
|
- 📚 Documentation updates
|
||||||
@@ -167,9 +203,9 @@ jobs:
|
|||||||
|
|
||||||
### Backporting Changes
|
### Backporting Changes
|
||||||
|
|
||||||
To backport a fix to this release branch:
|
To backport a fix:
|
||||||
1. Create your fix on \`main\` first
|
1. Create your fix on \`main\` first
|
||||||
2. Cherry-pick to \`$BRANCH_NAME\`
|
2. Cherry-pick to the target release branch
|
||||||
3. Create a PR targeting \`$BRANCH_NAME\`
|
3. Create a PR targeting that branch
|
||||||
4. Use the \`Release\` label on the PR
|
4. Apply the matching \`core/x.y\` or \`cloud/x.y\` label
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user