mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-19 06:52:31 +08:00
Refactor upstream release check and cleanup steps
This commit is contained in:
parent
b9600e36d4
commit
c7989867d7
44
.github/workflows/sync-build-release.yml
vendored
44
.github/workflows/sync-build-release.yml
vendored
@ -32,25 +32,41 @@ jobs:
|
|||||||
sudo apt-get install -y jq curl git
|
sudo apt-get install -y jq curl git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check for New Upstream Release
|
- name: Check for New Upstream Release (release-gated + file match)
|
||||||
id: check_version
|
id: check_version
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
LATEST_TAG=$(curl -s https://api.github.com/repos/comfyanonymous/ComfyUI/releases/latest | jq -r .tag_name)
|
|
||||||
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
# 1) Upstream latest release tag (e.g., v0.3.59)
|
||||||
if [ "$LATEST_TAG" != "$CURRENT_TAG" ]; then
|
LATEST_TAG=$(gh api repos/comfyanonymous/ComfyUI/releases/latest --jq .tag_name)
|
||||||
echo "new_version=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
# 2) Parse upstream comfyui_version.py from the current upstream default branch
|
||||||
echo "new_version=none" >> "$GITHUB_OUTPUT"
|
git remote add upstream https://github.com/comfyanonymous/ComfyUI.git 2>/dev/null || git remote set-url upstream https://github.com/comfyanonymous/ComfyUI.git
|
||||||
|
git fetch upstream --depth=1
|
||||||
|
FILE_VER=$(git show upstream/master:comfyui_version.py | sed -n 's/^__version__ = "\(.*\)"/\1/p' | tr -d '\r')
|
||||||
|
|
||||||
|
# Normalize release tag to bare version (strip leading 'v')
|
||||||
|
LATEST_VER="${LATEST_TAG#v}"
|
||||||
|
|
||||||
|
# 3) Only consider it "new" if the release tag matches the version file (avoid early bumps)
|
||||||
|
CANDIDATE="none"
|
||||||
|
if [ -n "${LATEST_TAG}" ] && [ "${LATEST_TAG}" != "null" ] && [ -n "${FILE_VER}" ] && [ "${FILE_VER}" = "${LATEST_VER}" ]; then
|
||||||
|
CANDIDATE="${LATEST_TAG}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Cleanup workspace (always, scoped)
|
# 4) Skip if this repo already has a release at that tag
|
||||||
if: ${{ always() }}
|
if [ "${CANDIDATE}" != "none" ]; then
|
||||||
run: |
|
SELF_TAG=$(gh api repos/${GITHUB_REPOSITORY}/releases/latest --jq .tag_name 2>/dev/null || echo "none")
|
||||||
set -euxo pipefail
|
if [ "${SELF_TAG}" = "${CANDIDATE}" ]; then
|
||||||
rm -rf "${GITHUB_WORKSPACE:?}/"* "${GITHUB_WORKSPACE:?}/."[!.]* 2>/dev/null || true
|
CANDIDATE="none"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "new_version=${CANDIDATE}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
build-gh:
|
build-gh:
|
||||||
name: Build on GitHub Runner (primary)
|
name: Build on GitHub Runner (primary)
|
||||||
needs: check-upstream
|
needs: check-upstream
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user