mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-15 13:02:35 +08:00
Update sync-build-release.yml
This commit is contained in:
parent
a0d4cc2faf
commit
3f8212cb2e
54
.github/workflows/sync-build-release.yml
vendored
54
.github/workflows/sync-build-release.yml
vendored
@ -42,21 +42,21 @@ jobs:
|
||||
|
||||
# 1) Upstream latest release tag (e.g., v0.3.59)
|
||||
LATEST_TAG=$(gh api repos/comfyanonymous/ComfyUI/releases/latest --jq .tag_name)
|
||||
|
||||
|
||||
# 2) Parse upstream comfyui_version.py from the current upstream default branch
|
||||
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
|
||||
|
||||
|
||||
# 4) Skip if this repo already has a release at that tag
|
||||
if [ "${CANDIDATE}" != "none" ]; then
|
||||
SELF_TAG=$(gh api repos/${GITHUB_REPOSITORY}/releases/latest --jq .tag_name 2>/dev/null || echo "none")
|
||||
@ -64,14 +64,24 @@ jobs:
|
||||
CANDIDATE="none"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo "new_version=${CANDIDATE}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cleanup workspace (always, scoped)
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
rm -rf "${GITHUB_WORKSPACE:?}/"* "${GITHUB_WORKSPACE:?}/."[!.]* 2>/dev/null || true
|
||||
|
||||
build-gh:
|
||||
name: Build on GitHub Runner (primary)
|
||||
needs: check-upstream
|
||||
if: needs.check-upstream.outputs.new_version != 'none'
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
outputs:
|
||||
built: ${{ steps.mark.outputs.built }}
|
||||
digest: ${{ steps.build.outputs.digest }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@ -99,7 +109,7 @@ jobs:
|
||||
git add README.md
|
||||
git commit -m "Merge upstream/master, keep local README.md" || true
|
||||
git push origin master
|
||||
|
||||
|
||||
- name: Show disk usage (pre)
|
||||
run: df -h | sed 's/\s\+/ /g'
|
||||
|
||||
@ -121,7 +131,7 @@ jobs:
|
||||
|
||||
- name: Show disk usage (post-clean)
|
||||
run: df -h | sed 's/\s\+/ /g'
|
||||
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
@ -154,6 +164,7 @@ jobs:
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Build and Push (GH runner)
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
@ -166,11 +177,19 @@ jobs:
|
||||
${{ env.IMAGE_NAME }}:${{ needs.check-upstream.outputs.new_version }}
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Mark build success
|
||||
id: mark
|
||||
if: ${{ success() && steps.build.outputs.digest != '' }}
|
||||
run: echo "built=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build-self:
|
||||
name: Build on Self-Hosted (fallback)
|
||||
needs: [check-upstream, build-gh]
|
||||
if: ${{ always() && needs.check-upstream.outputs.new_version != 'none' && needs.build-gh.result != 'success' }}
|
||||
if: needs.check-upstream.outputs.new_version != 'none' && needs.build-gh.outputs.built != 'true'
|
||||
runs-on: [self-hosted, linux, x64, homelab]
|
||||
outputs:
|
||||
built: ${{ steps.mark.outputs.built }}
|
||||
digest: ${{ steps.build.outputs.digest }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@ -199,17 +218,6 @@ jobs:
|
||||
git commit -m "Merge upstream/master, keep local README.md" || true
|
||||
git push origin master
|
||||
|
||||
- name: Show disk usage (pre)
|
||||
run: df -h | sed 's/\s\+/ /g'
|
||||
|
||||
- name: Prune Docker caches (pre)
|
||||
run: |
|
||||
docker builder prune -af || true
|
||||
docker system prune -af --volumes || true
|
||||
|
||||
- name: Show disk usage (post-clean)
|
||||
run: df -h | sed 's/\s\+/ /g'
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
@ -242,6 +250,7 @@ jobs:
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Build and Push (self-hosted)
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
@ -254,10 +263,15 @@ jobs:
|
||||
${{ env.IMAGE_NAME }}:${{ needs.check-upstream.outputs.new_version }}
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Mark build success
|
||||
id: mark
|
||||
if: ${{ success() && steps.build.outputs.digest != '' }}
|
||||
run: echo "built=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
publish:
|
||||
name: Publish Release
|
||||
needs: [check-upstream, build-gh, build-self]
|
||||
if: ${{ needs.check-upstream.outputs.new_version != 'none' && (needs.build-gh.result == 'success' || needs.build-self.result == 'success') }}
|
||||
if: needs.check-upstream.outputs.new_version != 'none' && (needs.build-gh.outputs.built == 'true' || needs.build-self.outputs.built == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create GitHub Release
|
||||
|
||||
Loading…
Reference in New Issue
Block a user