-
Notifications
You must be signed in to change notification settings - Fork 204
Automate ComfyUI release bump workflow #1593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
53c0871
9eccdce
842c772
982b9b5
797ce31
519d391
4442026
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| name: Auto Bump ComfyUI Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| comfyui_version: | ||
| description: 'Optional ComfyUI version or tag (e.g. 0.12.3 or v0.12.3)' | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: auto-bump-comfyui-release | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| bump-comfyui: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout desktop repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Resolve target ComfyUI version | ||
| id: version | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| INPUT_COMFYUI_VERSION: ${{ github.event.inputs.comfyui_version || '' }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| normalize_version() { | ||
| local raw_version="$1" | ||
| raw_version="${raw_version#refs/tags/}" | ||
| raw_version="${raw_version#v}" | ||
| echo "$raw_version" | ||
| } | ||
|
|
||
| if [ -n "${INPUT_COMFYUI_VERSION:-}" ]; then | ||
| TARGET_VERSION="$(normalize_version "$INPUT_COMFYUI_VERSION")" | ||
| TARGET_TAG="v${TARGET_VERSION}" | ||
| TARGET_RELEASE_URL="https://github.com/Comfy-Org/ComfyUI/releases/tag/${TARGET_TAG}" | ||
| else | ||
| RELEASE_JSON="$(curl -fsSL \ | ||
| -H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| https://api.github.com/repos/Comfy-Org/ComfyUI/releases/latest)" | ||
|
|
||
| TARGET_TAG="$(echo "$RELEASE_JSON" | jq -r '.tag_name')" | ||
| TARGET_RELEASE_URL="$(echo "$RELEASE_JSON" | jq -r '.html_url')" | ||
| if [ -z "$TARGET_TAG" ] || [ "$TARGET_TAG" = "null" ]; then | ||
| echo "Could not resolve ComfyUI latest release tag" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| TARGET_VERSION="${TARGET_TAG#v}" | ||
| fi | ||
|
|
||
| if [[ -z "$TARGET_VERSION" || ! "$TARGET_VERSION" =~ ^[0-9A-Za-z._-]+$ ]]; then | ||
| echo "Invalid ComfyUI version: ${TARGET_VERSION}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| TAG_STATUS="$(curl -fsSL -o /dev/null -w '%{http_code}' \ | ||
| -H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/Comfy-Org/ComfyUI/git/ref/tags/${TARGET_TAG}")" | ||
| if [ "$TAG_STATUS" != "200" ]; then | ||
| echo "ComfyUI tag not found: ${TARGET_TAG}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| CURRENT_VERSION="$(jq -r '.config.comfyUI.version' package.json)" | ||
|
|
||
| { | ||
| echo "target_tag=${TARGET_TAG}" | ||
| echo "target_version=${TARGET_VERSION}" | ||
| echo "target_release_url=${TARGET_RELEASE_URL}" | ||
| echo "current_version=${CURRENT_VERSION}" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| if [ "$TARGET_VERSION" = "$CURRENT_VERSION" ]; then | ||
| echo "should_update=false" >> "$GITHUB_OUTPUT" | ||
| echo "ComfyUI version already at ${CURRENT_VERSION}; skipping." | ||
| else | ||
| echo "should_update=true" >> "$GITHUB_OUTPUT" | ||
| echo "Will bump ComfyUI from ${CURRENT_VERSION} to ${TARGET_VERSION}." | ||
| fi | ||
|
|
||
| - name: Update package.json ComfyUI version | ||
| if: steps.version.outputs.should_update == 'true' | ||
| env: | ||
| TARGET_VERSION: ${{ steps.version.outputs.target_version }} | ||
| run: | | ||
| set -euo pipefail | ||
| TMP_FILE="$(mktemp)" | ||
| jq --arg version "$TARGET_VERSION" '.config.comfyUI.version = $version' package.json > "$TMP_FILE" | ||
| mv "$TMP_FILE" package.json | ||
|
|
||
| - name: Checkout target ComfyUI release | ||
| if: steps.version.outputs.should_update == 'true' | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: Comfy-Org/ComfyUI | ||
| ref: ${{ steps.version.outputs.target_tag }} | ||
| path: assets/ComfyUI | ||
|
|
||
| - name: Regenerate core requirements patch | ||
| if: steps.version.outputs.should_update == 'true' | ||
| run: | | ||
| set -euo pipefail | ||
| bash scripts/regenerateCoreRequirementsPatch.sh | ||
|
Comment on lines
+123
to
+135
|
||
|
|
||
| - name: Apply core requirements patch | ||
| if: steps.version.outputs.should_update == 'true' | ||
| run: | | ||
| set -euo pipefail | ||
| cd assets/ComfyUI | ||
| patch -p1 < ../../scripts/core-requirements.patch | ||
|
|
||
| - name: Install uv | ||
| if: steps.version.outputs.should_update == 'true' | ||
| run: | | ||
| set -euo pipefail | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | ||
| "$HOME/.local/bin/uv" --version | ||
|
|
||
| - name: Recompile pre-shipped requirements | ||
| if: steps.version.outputs.should_update == 'true' | ||
| run: | | ||
| set -euo pipefail | ||
| bash scripts/recompileRequirementsFromHeaders.sh | ||
|
|
||
| - name: Clean generated ComfyUI checkout | ||
| if: steps.version.outputs.should_update == 'true' | ||
| run: rm -rf assets/ComfyUI | ||
|
|
||
| - name: Create pull request | ||
| if: steps.version.outputs.should_update == 'true' | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ github.token }} | ||
| branch: automated/bump-comfyui-v${{ steps.version.outputs.target_version }} | ||
| delete-branch: true | ||
| commit-message: Bump ComfyUI to v${{ steps.version.outputs.target_version }} | ||
| title: Bump ComfyUI to v${{ steps.version.outputs.target_version }} | ||
| body: | | ||
| ## Summary | ||
| - bump `config.comfyUI.version` from `${{ steps.version.outputs.current_version }}` to `${{ steps.version.outputs.target_version }}` | ||
| - regenerate `scripts/core-requirements.patch` from upstream ComfyUI requirements | ||
| - recompile pre-shipped requirements in `assets/requirements/*.compiled` using `uv pip compile` commands stored in file headers | ||
|
|
||
| ## Upstream Release | ||
| - ${{ steps.version.outputs.target_release_url }} | ||
|
|
||
| ## Testing | ||
| - workflow regenerated compiled requirements and patch artifacts | ||
| labels: dependencies | ||
| add-paths: | | ||
| package.json | ||
| scripts/core-requirements.patch | ||
| assets/requirements/*.compiled | ||
|
Comment on lines
+168
to
+192
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PRs created with GitHub deliberately prevents workflows triggered by the default If CI validation on the bump PR is required, swap - token: ${{ github.token }}
+ token: ${{ steps.app-token.outputs.token }}(after adding a step to generate a token from a GitHub App installation) If the intent is to merge without CI or to manually re-trigger, the current setup is fine — just document that expectation. 🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| usage() { | ||
| cat <<'USAGE' | ||
| Re-run uv compile commands embedded in assets/requirements/*.compiled headers. | ||
|
|
||
| Usage: | ||
| scripts/recompileRequirementsFromHeaders.sh [--dry-run] [compiled-file ...] | ||
|
|
||
| Examples: | ||
| scripts/recompileRequirementsFromHeaders.sh --dry-run | ||
| scripts/recompileRequirementsFromHeaders.sh | ||
| scripts/recompileRequirementsFromHeaders.sh assets/requirements/macos.compiled | ||
| USAGE | ||
| } | ||
|
|
||
| dry_run=0 | ||
| compiled_files=() | ||
|
|
||
| for argument in "$@"; do | ||
| case "$argument" in | ||
| --dry-run) | ||
| dry_run=1 | ||
| ;; | ||
| -h|--help) | ||
| usage | ||
| exit 0 | ||
| ;; | ||
| *) | ||
| compiled_files+=("$argument") | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [[ ! -f "package.json" || ! -d "assets/requirements" ]]; then | ||
| echo "Run this script from the desktop repository root." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ${#compiled_files[@]} -eq 0 ]]; then | ||
| mapfile -t compiled_files < <(find assets/requirements -maxdepth 1 -type f -name '*.compiled' | sort) | ||
| fi | ||
|
|
||
| if [[ ${#compiled_files[@]} -eq 0 ]]; then | ||
| echo "No compiled requirements files found." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| for compiled_file in "${compiled_files[@]}"; do | ||
| if [[ ! -f "$compiled_file" ]]; then | ||
| echo "Missing file: $compiled_file" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| compile_command="$( | ||
| awk ' | ||
| /^#/ { | ||
| line = $0 | ||
| sub(/^#[[:space:]]*/, "", line) | ||
| if (line ~ /^uv[[:space:]]+pip[[:space:]]+compile([[:space:]]|$)/) { | ||
| print line | ||
| exit | ||
| } | ||
| } | ||
| ' "$compiled_file" | ||
| )" | ||
| if [[ -z "$compile_command" ]]; then | ||
| echo "Could not extract uv pip compile command from header comments in $compiled_file" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| output_path="$(printf '%s\n' "$compile_command" | awk '{ | ||
| for (i = 1; i <= NF; i++) { | ||
| if ($i == "-o" && i < NF) { | ||
| print $(i + 1) | ||
| exit | ||
| } | ||
| } | ||
| }')" | ||
| if [[ -z "$output_path" ]]; then | ||
| echo "Could not find output path (-o) in compile command for $compiled_file" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| output_path="${output_path%\"}" | ||
| output_path="${output_path#\"}" | ||
| output_path="${output_path%\'}" | ||
| output_path="${output_path#\'}" | ||
|
|
||
| normalized_compiled_file="${compiled_file#./}" | ||
| normalized_output_path="${output_path#./}" | ||
| if [[ "$normalized_output_path" != "$normalized_compiled_file" ]]; then | ||
| echo "Compile command output path mismatch for $compiled_file" >&2 | ||
| echo "Expected: $normalized_compiled_file" >&2 | ||
| echo "Found: $normalized_output_path" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "[$compiled_file]" | ||
| echo "$compile_command" | ||
|
|
||
| if [[ $dry_run -eq 0 ]]; then | ||
| bash -lc "$compile_command" | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| done | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| requirements_path="${1:-assets/ComfyUI/requirements.txt}" | ||
| output_patch="${2:-scripts/core-requirements.patch}" | ||
|
|
||
| if [[ ! -f "$requirements_path" ]]; then | ||
| echo "Requirements file not found: $requirements_path" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| tmp_dir="$(mktemp -d)" | ||
| trap 'rm -rf "$tmp_dir"' EXIT | ||
|
|
||
| original_requirements="$tmp_dir/requirements.original.txt" | ||
| patched_requirements="$tmp_dir/requirements.patched.txt" | ||
| frontend_pattern='^[[:space:]]*comfyui-frontend-package(\[[^]]+\])?([[:space:]]*([<>=!~].*)?)?$' | ||
|
|
||
| cp "$requirements_path" "$original_requirements" | ||
|
|
||
| if ! grep -Eq "$frontend_pattern" "$original_requirements"; then | ||
| echo "Missing comfyui-frontend-package pin in: $requirements_path" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| grep -Ev "$frontend_pattern" "$original_requirements" > "$patched_requirements" | ||
|
|
||
| if cmp -s "$original_requirements" "$patched_requirements"; then | ||
| echo "No changes detected after removing comfyui-frontend-package from $requirements_path" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| diff_body="$(diff -u --label a/requirements.txt --label b/requirements.txt "$original_requirements" "$patched_requirements" || true)" | ||
|
|
||
| if [[ -z "$diff_body" ]]; then | ||
| echo "Failed to generate patch body for $requirements_path" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| { | ||
| echo "diff --git a/requirements.txt b/requirements.txt" | ||
| echo "$diff_body" | ||
| } > "$output_patch" | ||
|
|
||
| echo "Wrote $output_patch from $requirements_path" |
Uh oh!
There was an error while loading. Please reload this page.