mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-19 06:52:31 +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)
|
# 1) Upstream latest release tag (e.g., v0.3.59)
|
||||||
LATEST_TAG=$(gh api repos/comfyanonymous/ComfyUI/releases/latest --jq .tag_name)
|
LATEST_TAG=$(gh api repos/comfyanonymous/ComfyUI/releases/latest --jq .tag_name)
|
||||||
|
|
||||||
# 2) Parse upstream comfyui_version.py from the current upstream default branch
|
# 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 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
|
git fetch upstream --depth=1
|
||||||
FILE_VER=$(git show upstream/master:comfyui_version.py | sed -n 's/^__version__ = "\(.*\)"/\1/p' | tr -d '\r')
|
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')
|
# Normalize release tag to bare version (strip leading 'v')
|
||||||
LATEST_VER="${LATEST_TAG#v}"
|
LATEST_VER="${LATEST_TAG#v}"
|
||||||
|
|
||||||
# 3) Only consider it "new" if the release tag matches the version file (avoid early bumps)
|
# 3) Only consider it "new" if the release tag matches the version file (avoid early bumps)
|
||||||
CANDIDATE="none"
|
CANDIDATE="none"
|
||||||
if [ -n "${LATEST_TAG}" ] && [ "${LATEST_TAG}" != "null" ] && [ -n "${FILE_VER}" ] && [ "${FILE_VER}" = "${LATEST_VER}" ]; then
|
if [ -n "${LATEST_TAG}" ] && [ "${LATEST_TAG}" != "null" ] && [ -n "${FILE_VER}" ] && [ "${FILE_VER}" = "${LATEST_VER}" ]; then
|
||||||
CANDIDATE="${LATEST_TAG}"
|
CANDIDATE="${LATEST_TAG}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 4) Skip if this repo already has a release at that tag
|
# 4) Skip if this repo already has a release at that tag
|
||||||
if [ "${CANDIDATE}" != "none" ]; then
|
if [ "${CANDIDATE}" != "none" ]; then
|
||||||
SELF_TAG=$(gh api repos/${GITHUB_REPOSITORY}/releases/latest --jq .tag_name 2>/dev/null || echo "none")
|
SELF_TAG=$(gh api repos/${GITHUB_REPOSITORY}/releases/latest --jq .tag_name 2>/dev/null || echo "none")
|
||||||
@ -64,14 +64,24 @@ jobs:
|
|||||||
CANDIDATE="none"
|
CANDIDATE="none"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "new_version=${CANDIDATE}" >> "$GITHUB_OUTPUT"
|
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:
|
build-gh:
|
||||||
name: Build on GitHub Runner (primary)
|
name: Build on GitHub Runner (primary)
|
||||||
needs: check-upstream
|
needs: check-upstream
|
||||||
if: needs.check-upstream.outputs.new_version != 'none'
|
if: needs.check-upstream.outputs.new_version != 'none'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
outputs:
|
||||||
|
built: ${{ steps.mark.outputs.built }}
|
||||||
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@ -99,7 +109,7 @@ jobs:
|
|||||||
git add README.md
|
git add README.md
|
||||||
git commit -m "Merge upstream/master, keep local README.md" || true
|
git commit -m "Merge upstream/master, keep local README.md" || true
|
||||||
git push origin master
|
git push origin master
|
||||||
|
|
||||||
- name: Show disk usage (pre)
|
- name: Show disk usage (pre)
|
||||||
run: df -h | sed 's/\s\+/ /g'
|
run: df -h | sed 's/\s\+/ /g'
|
||||||
|
|
||||||
@ -121,7 +131,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Show disk usage (post-clean)
|
- name: Show disk usage (post-clean)
|
||||||
run: df -h | sed 's/\s\+/ /g'
|
run: df -h | sed 's/\s\+/ /g'
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
@ -154,6 +164,7 @@ jobs:
|
|||||||
password: ${{ secrets.CR_PAT }}
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
- name: Build and Push (GH runner)
|
- name: Build and Push (GH runner)
|
||||||
|
id: build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@ -166,11 +177,19 @@ jobs:
|
|||||||
${{ env.IMAGE_NAME }}:${{ needs.check-upstream.outputs.new_version }}
|
${{ env.IMAGE_NAME }}:${{ needs.check-upstream.outputs.new_version }}
|
||||||
${{ env.IMAGE_NAME }}:latest
|
${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
||||||
|
- name: Mark build success
|
||||||
|
id: mark
|
||||||
|
if: ${{ success() && steps.build.outputs.digest != '' }}
|
||||||
|
run: echo "built=true" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
build-self:
|
build-self:
|
||||||
name: Build on Self-Hosted (fallback)
|
name: Build on Self-Hosted (fallback)
|
||||||
needs: [check-upstream, build-gh]
|
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]
|
runs-on: [self-hosted, linux, x64, homelab]
|
||||||
|
outputs:
|
||||||
|
built: ${{ steps.mark.outputs.built }}
|
||||||
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@ -199,17 +218,6 @@ jobs:
|
|||||||
git commit -m "Merge upstream/master, keep local README.md" || true
|
git commit -m "Merge upstream/master, keep local README.md" || true
|
||||||
git push origin master
|
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
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
@ -242,6 +250,7 @@ jobs:
|
|||||||
password: ${{ secrets.CR_PAT }}
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
- name: Build and Push (self-hosted)
|
- name: Build and Push (self-hosted)
|
||||||
|
id: build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@ -254,10 +263,15 @@ jobs:
|
|||||||
${{ env.IMAGE_NAME }}:${{ needs.check-upstream.outputs.new_version }}
|
${{ env.IMAGE_NAME }}:${{ needs.check-upstream.outputs.new_version }}
|
||||||
${{ env.IMAGE_NAME }}:latest
|
${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
||||||
|
- name: Mark build success
|
||||||
|
id: mark
|
||||||
|
if: ${{ success() && steps.build.outputs.digest != '' }}
|
||||||
|
run: echo "built=true" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish Release
|
name: Publish Release
|
||||||
needs: [check-upstream, build-gh, build-self]
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user