Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Publish every platform in one release: a rolling nightly and stable vX.Y.Z (#54)

Bowen Xuec72a5ae75fb7
diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml
index ea4b66e..49015ee 100644
--- a/.github/workflows/install.yml
+++ b/.github/workflows/install.yml
@@ -1,22 +1,32 @@
-name: Installation and Windows launcher
+name: Installation and launchers
+# Every merge to main publishes the rolling nightly (Windows unsigned, Mac not notarized).
+# Users get an update only from a stable vX.Y.Z release, published by running this
+# workflow with "release" checked; Windows signing then waits for the release environment.
on:
push:
branches: [main]
+ # A change to the workflows alone does not publish a new Windows build.
paths-ignore:
- '**/*.md'
+ - '.github/**'
pull_request:
paths-ignore:
- '**/*.md'
workflow_dispatch:
inputs:
+ release:
+ description: 'Publish main as the stable release vX.Y.Z named in release_notes.json; users get an update notice'
+ type: boolean
+ default: false
defender_baseline:
description: 'Also diagnose the currently published package before rebuilding'
type: boolean
default: false
permissions:
contents: read
+# Stable runs have their own group: a later merge must not replace a pending release.
concurrency:
- group: freevideo-public-${{ github.event.pull_request.number || github.ref }}
+ group: freevideo-public-${{ github.event.pull_request.number || github.ref }}-${{ github.event_name == 'workflow_dispatch' && inputs.release && 'stable' || 'build' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
installation:
@@ -46,21 +56,33 @@ jobs:
run: |
python -m pip install build
python -m build
+ # Fail a stable run before anyone is asked to approve signing.
+ - name: Check that this version is not released yet
+ if: github.event_name == 'workflow_dispatch' && inputs.release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ version=$(python -c 'import json; print(json.load(open("freevideo_engine/release_notes.json"))["product_version"])')
+ if gh api "repos/${{ github.repository }}/git/matching-refs/tags/v$version" --jq '.[].ref' | grep -qx "refs/tags/v$version"; then
+ echo "::error::v$version is already released. Bump product_version and the notes in freevideo_engine/release_notes.json first."
+ exit 1
+ fi
+ echo "Publishing v$version"
windows:
+ # Build once, after merging; pull requests run the installation checks only.
+ if: github.event_name != 'pull_request'
needs: [installation]
runs-on: windows-2025
timeout-minutes: 60
permissions:
- contents: write
+ contents: read
id-token: write
- # Pull requests and forks build unsigned. Every other run uses the release environment, whose deployment rules and reviewers decide who can mint the OIDC token Azure trusts for signing.
- environment: ${{ github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo' && 'release' || '' }}
- concurrency:
- group: windows-launcher-release-${{ github.ref }}
- cancel-in-progress: false
+ # Only stable releases are signed. They use the release environment, whose reviewers decide who can mint the OIDC token Azure trusts for signing.
+ environment: ${{ github.event_name == 'workflow_dispatch' && inputs.release && github.repository == 'FlashML-org/FreeVideo' && 'release' || '' }}
env:
PYTHONUTF8: '1'
PYTHONIOENCODING: utf-8
+ FREEVIDEO_RELEASE_TRACK: ${{ github.event_name == 'workflow_dispatch' && inputs.release && 'stable' || 'nightly' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
@@ -86,7 +108,7 @@ jobs:
# new final bytes must pass the mandatory protection gate below.
exit 0
- name: Azure login (OIDC)
- if: github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo'
+ if: github.event_name == 'workflow_dispatch' && inputs.release && github.repository == 'FlashML-org/FreeVideo'
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
@@ -94,13 +116,13 @@ jobs:
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
# The GitHub OIDC assertion behind the login expires after 5 minutes (azure-cli#29063). A signing token fetched now is cached by az for the whole job.
- name: Fetch the signing token
- if: github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo'
+ if: github.event_name == 'workflow_dispatch' && inputs.release && github.repository == 'FlashML-org/FreeVideo'
run: |
az account get-access-token --scope https://codesigning.azure.net/.default --output none
if ($LASTEXITCODE -ne 0) { throw 'Could not get a codesigning.azure.net token' }
# The launcher runs these scripts from its unpacked tree, where the executable's signature does not cover them. Sign the checkout's copies before the build bundles them.
- name: Sign bundled PowerShell scripts
- if: github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo'
+ if: github.event_name == 'workflow_dispatch' && inputs.release && github.repository == 'FlashML-org/FreeVideo'
uses: azure/trusted-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2.0.0
with:
endpoint: https://eus.codesigning.azure.net/
@@ -121,7 +143,7 @@ jobs:
python scripts/build_windows.py --out build/windows-exe
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Sign Windows launchers
- if: github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo'
+ if: github.event_name == 'workflow_dispatch' && inputs.release && github.repository == 'FlashML-org/FreeVideo'
uses: azure/trusted-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2.0.0
with:
endpoint: https://eus.codesigning.azure.net/
@@ -135,7 +157,7 @@ jobs:
timestamp-digest: SHA256
# Check the copies that ship: the folder layout exposes every bundled script on disk, and the one-file launcher is built from the same inputs.
- name: Verify signatures and rebuild the folder ZIP around the signed launcher
- if: github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo'
+ if: github.event_name == 'workflow_dispatch' && inputs.release && github.repository == 'FlashML-org/FreeVideo'
shell: pwsh
run: |
$scripts = @(Get-ChildItem build/windows-folder/dist -Recurse -Filter *.ps1 | ForEach-Object FullName)
@@ -165,160 +187,90 @@ jobs:
Get-ChildItem antivirus -File -ErrorAction SilentlyContinue | ForEach-Object { Write-Output $_.Name; Get-Content $_.FullName -Tail 100 }
Get-ChildItem (Join-Path $env:USERPROFILE 'Downloads/FreeVideo-release-check-*') -Recurse -File -ErrorAction SilentlyContinue |
Where-Object { $_.Name -eq 'smoke.json' } | ForEach-Object { Get-Content $_.FullName -Raw }
- # Release assets use Releases storage, not the Actions artifact quota.
- # This step still requires all installation/build/startup checks above.
- - name: Publish Windows launcher
- if: github.repository == 'FlashML-org/FreeVideo' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
- working-directory: build/windows-exe/dist
+ - name: Keep the Windows launcher for publishing
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: windows-launcher
+ path: |
+ build/windows-exe/dist/FreeVideo.exe
+ build/windows-exe/dist/launcher-build.json
+ if-no-files-found: error
+ retention-days: 1
+ macos:
+ if: github.event_name != 'pull_request'
+ needs: [installation]
+ runs-on: macos-15
+ timeout-minutes: 30
+ permissions:
+ contents: read
+ env:
+ FREEVIDEO_RELEASE_TRACK: ${{ github.event_name == 'workflow_dispatch' && inputs.release && 'stable' || 'nightly' }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: '3.12'
+ architecture: arm64
+ cache: pip
+ cache-dependency-path: constraints/macos-launcher.txt
+ - name: Check installation and build the Apple Silicon launcher
+ run: |
+ python -c "import platform; assert platform.machine() == 'arm64'"
+ python scripts/check_installation.py
+ python -m pip install -r constraints/macos-launcher.txt
+ python scripts/build_macos.py --out build/macos
+ - name: Verify the disk image and native startup
+ env:
+ FREEVIDEO_LAUNCHER_HOME: ${{ runner.temp }}/freevideo-launcher-state
+ run: |
+ python scripts/verify_macos_build.py --build build/macos --out build/macos-verification
+ build/macos/applications.noindex/FreeVideo.app/Contents/MacOS/FreeVideo --smoke-test "$RUNNER_TEMP/freevideo-smoke"
+ python -c "import json, os; from pathlib import Path; value=json.loads((Path(os.environ['RUNNER_TEMP'])/'freevideo-smoke/smoke.json').read_text()); assert value['success'] and not value['model_modules_imported']"
+ - name: Keep the Mac launcher for publishing
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: macos-launcher
+ path: |
+ build/macos/dist/FreeVideo-Mac-arm64.dmg
+ build/macos/launcher-build.json
+ if-no-files-found: error
+ retention-days: 1
+ - name: Keep failure diagnostics
+ if: failure()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: macos-build-failure
+ path: |
+ build/macos/build-result.json
+ build/macos-verification/result.json
+ ${{ runner.temp }}/freevideo-smoke/smoke.json
+ if-no-files-found: ignore
+ retention-days: 1
+ publish:
+ # Release assets use Releases storage, not the Actions artifact quota.
+ if: github.event_name != 'pull_request' && github.repository == 'FlashML-org/FreeVideo' && github.ref == 'refs/heads/main'
+ needs: [windows, macos]
+ runs-on: ubuntu-24.04
+ timeout-minutes: 30
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: '3.12'
+ - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
+ with:
+ name: windows-launcher
+ path: build/windows
+ - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
+ with:
+ name: macos-launcher
+ path: build/macos
+ - name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
- shell: bash
- run: |
- set -euo pipefail
- # Python writes CRLF on Windows; strip line endings before GNU checks.
- tr -d '\r' < SHA256SUMS.txt | sha256sum --check -
- # BEGIN RETRY HELPERS
- gh_retry() {
- local label="$1"; shift
- local attempt code
- for attempt in 1 2 3; do
- echo "$label (attempt $attempt/3)" >&2
- if timeout 300s "$@"; then return 0; else code=$?; fi
- if [ "$attempt" -lt 3 ]; then sleep "$((attempt * 2))"; fi
- done
- echo "::error::$label failed after 3 attempts (exit $code)" >&2
- return "$code"
- }
- gh_json() {
- local label="$1"; shift
- local attempt result
- result=$(mktemp)
- for attempt in 1 2 3; do
- echo "$label (attempt $attempt/3)" >&2
- if timeout 60s gh "$@" > "$result"; then
- if python -m json.tool "$result" > /dev/null; then
- cat "$result"; rm -f "$result"; return 0
- fi
- echo "$label returned empty or incomplete JSON; retrying the read" >&2
- fi
- if [ "$attempt" -lt 3 ]; then sleep "$((attempt * 2))"; fi
- done
- rm -f "$result"
- echo "::error::$label failed: GitHub did not return a complete JSON response" >&2
- return 1
- }
- # END RETRY HELPERS
- # A single moving preview avoids retaining old development snapshots.
- gh_json 'Read current main' api "repos/$GH_REPO/git/ref/heads/main" > main.json
- current_main=$(python -c 'import json; print(json.load(open("main.json"))["object"]["sha"])' | tr -d '\r')
- if [ "$current_main" != "$GITHUB_SHA" ]; then
- # README editing must not discard a checked installer. Publish the
- # exact built revision only when main is its README-only descendant.
- # Runtime/workflow changes and force-push divergence still stop it.
- gh_json 'Check changes after this build' api "repos/$GH_REPO/compare/$GITHUB_SHA...$current_main" > comparison.json
- if ! python - <<'PY_CURRENT'
- import json, os, sys
- comparison = json.load(open('comparison.json'))
- files = comparison.get('files')
- allowed = {'README.md', 'README.zh-CN.md'}
- safe = (comparison.get('status') == 'ahead'
- and comparison.get('merge_base_commit', {}).get('sha') == os.environ['GITHUB_SHA']
- and isinstance(files, list) and len(files) <= len(allowed)
- and all(row.get('filename') in allowed
- and row.get('previous_filename', row.get('filename')) in allowed
- for row in files))
- sys.exit(0 if safe else 1)
- PY_CURRENT
- then
- exit 0
- fi
- fi
- preview_tag=windows-preview
- cat > release-notes.md <<'NOTES'
- <div align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="https://freevideo-community.pages.dev/logo-dark.svg">
- <img alt="FreeVideo" src="https://freevideo-community.pages.dev/logo-light.svg" width="55%">
- </picture>
- </div>
-
- Run MiniMax H3 on your own GPU, with FreeVideo inside ComfyUI.
-
- Now supports community LoRAs. [See comparisons](https://github.com/FlashML-org/FreeVideo/blob/main/docs/LoRA.md).
-
- 1. [Download FreeVideo.exe](https://github.com/FlashML-org/FreeVideo/releases/download/windows-preview/FreeVideo.exe) and run it.
- 2. Select an existing ComfyUI folder or install a new one. Add existing model folders to reuse your files; missing models download automatically.
- 3. Click **Install & launch** to open the FreeVideo workspace in your browser.
-
- **Offline installation:** Get the packages from [Quark](https://pan.quark.cn/s/c51235b84618) and drag the ZIP files into the launcher. No extraction needed. See the [installation guide](https://github.com/FlashML-org/FreeVideo#getting-started) for package choices.
-
- ### 中文
-
- FreeVideo 让 MiniMax H3 在消费级显卡上本地运行,打开 ComfyUI 即可创作。
-
- 支持社区 LoRA。[查看效果对比](https://github.com/FlashML-org/FreeVideo/blob/main/docs/LoRA.zh-CN.md)。
-
- 1. [下载 FreeVideo.exe](https://github.com/FlashML-org/FreeVideo/releases/download/windows-preview/FreeVideo.exe) 并运行。
- 2. 选择已有的 ComfyUI 或安装新的 ComfyUI。可添加模型目录以复用文件,缺失的模型会自动下载。
- 3. 点击 **安装并启动**,浏览器中会打开 FreeVideo 创作面板。
-
- **离线安装:** 从[夸克网盘](https://pan.quark.cn/s/c51235b84618)下载离线包,将 ZIP 直接拖入启动器,无需解压。包的选择见[安装说明](https://github.com/FlashML-org/FreeVideo/blob/main/README.zh-CN.md#开始使用)。
-
- [Discord](https://discord.gg/MsA277cJzZ) · [QQ Group / QQ 群](https://freevideo-community.pages.dev/qq) · [WeChat Group / 微信群](https://freevideo-community.pages.dev/wechat)
- NOTES
- python "$GITHUB_WORKSPACE/freevideo_engine/release_notes.py" --build launcher-build.json --out release-notes.md --prepend
- release_title=$(python -c 'import json; print("FreeVideo v" + json.load(open("launcher-build.json"))["product_version"] + " for Windows")' | tr -d '\r')
- # A failed read is not evidence that a tag or release is missing.
- gh_json 'Read preview tags' api "repos/$GH_REPO/git/matching-refs/tags/$preview_tag" > tags.json
- tag_exists=$(python -c 'import json; print(int(any(r["ref"] == "refs/tags/windows-preview" for r in json.load(open("tags.json")))))' | tr -d '\r')
- gh_json 'Read releases including drafts' api --paginate --slurp "repos/$GH_REPO/releases?per_page=100" > releases.json
- release_exists=$(python -c 'import json; print(int(any(r["tag_name"] == "windows-preview" for page in json.load(open("releases.json")) for r in page)))' | tr -d '\r')
- if [ "$tag_exists" = 1 ]; then
- gh_retry 'Update preview tag' gh api -X PATCH "repos/$GH_REPO/git/refs/tags/$preview_tag" -f sha="$GITHUB_SHA" -F force=true > /dev/null
- else
- gh_retry 'Create preview tag' gh api -X POST "repos/$GH_REPO/git/refs" -f ref="refs/tags/$preview_tag" -f sha="$GITHUB_SHA" > /dev/null
- fi
- if [ "$release_exists" = 0 ]; then
- gh_retry 'Create draft release' gh release create "$preview_tag" --verify-tag --draft --prerelease --latest=false --title "$release_title" --notes-file release-notes.md
- fi
- gh_retry 'Upload launcher' gh release upload "$preview_tag" FreeVideo.exe SHA256SUMS.txt --clobber
- # Publish metadata last, bound to the immutable executable asset ID.
- # Readers reject a mismatched pair while a moving preview is updating.
- gh_json 'Locate release including drafts' release view "$preview_tag" --json databaseId > release-id.json
- release_id=$(python -c 'import json; print(json.load(open("release-id.json"))["databaseId"])' | tr -d '\r')
- gh_json 'Read uploaded asset metadata' api "repos/$GH_REPO/releases/$release_id" > release.json
- python - <<'PY'
- import hashlib, json
- from pathlib import Path
- build = json.loads(Path('launcher-build.json').read_text())
- release = json.loads(Path('release.json').read_text())
- asset = next(a for a in release['assets'] if a['name'] == 'FreeVideo.exe')
- binary = Path('FreeVideo.exe')
- assert asset['size'] == binary.stat().st_size
- build['asset'] = dict(id=asset['id'], bytes=binary.stat().st_size,
- sha256=hashlib.sha256(binary.read_bytes()).hexdigest())
- Path('update.json').write_text(json.dumps(build, indent=2))
- PY
- # The folder ZIP is no longer published; remove the copy an earlier
- # release left so the page lists only current files.
- retired=$(python -c 'import json; print(int(any(a["name"] == "FreeVideo-Windows-folder.zip" for a in json.load(open("release.json"))["assets"])))' | tr -d '\r')
- if [ "$retired" = 1 ]; then
- gh_retry 'Remove retired folder ZIP' gh release delete-asset "$preview_tag" FreeVideo-Windows-folder.zip --yes
- fi
- gh_retry 'Upload update manifest' gh release upload "$preview_tag" update.json --clobber
- gh_retry 'Publish release' gh release edit "$preview_tag" --draft=false --prerelease --latest=false --title "$release_title" --notes-file release-notes.md
- # Previous development snapshots have been archived privately.
- # Remove their release/source-archive references only after replacement.
- python - <<'PY_CLEANUP'
- import json
- from pathlib import Path
- releases = json.loads(Path('releases.json').read_text())
- tags = [r['tag_name'] for page in releases for r in page
- if r['tag_name'].startswith('windows-preview-')]
- Path('previous-previews.txt').write_text(''.join(tag + '\n' for tag in tags))
- PY_CLEANUP
- while IFS= read -r previous; do
- previous=${previous%$'\r'}
- gh_retry 'Remove archived preview' gh release delete "$previous" --cleanup-tag --yes
- done < previous-previews.txt
+ run: >-
+ python scripts/publish_release.py --track ${{ github.event_name == 'workflow_dispatch' && inputs.release && 'stable' || 'nightly' }}
+ --windows build/windows --macos build/macos --sha ${{ github.sha }}
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
deleted file mode 100644
index 363da9d..0000000
--- a/.github/workflows/macos.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-name: Build Mac launcher
-on:
- workflow_dispatch:
-permissions:
- contents: read
-concurrency:
- group: freevideo-macos-build-${{ github.ref }}
- cancel-in-progress: false
-jobs:
- macos:
- runs-on: macos-15
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
- with:
- python-version: '3.12'
- architecture: arm64
- cache: pip
- cache-dependency-path: constraints/macos-launcher.txt
- - name: Check installation and build the Apple Silicon launcher
- run: |
- python -c "import platform; assert platform.machine() == 'arm64'"
- python scripts/check_installation.py
- python -m pip install -r constraints/macos-launcher.txt
- python scripts/build_macos.py --out build/macos
- - name: Verify both archives and native startup
- env:
- FREEVIDEO_LAUNCHER_HOME: ${{ runner.temp }}/freevideo-launcher-state
- run: |
- python scripts/verify_macos_build.py --build build/macos --out build/macos-verification
- build/macos/applications.noindex/FreeVideo.app/Contents/MacOS/FreeVideo --smoke-test "$RUNNER_TEMP/freevideo-smoke"
- python -c "import json, os; from pathlib import Path; value=json.loads((Path(os.environ['RUNNER_TEMP'])/'freevideo-smoke/smoke.json').read_text()); assert value['success'] and not value['model_modules_imported']"
- - name: Keep checked preview artifacts
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: FreeVideo-Mac-arm64-${{ github.sha }}
- path: |
- build/macos/dist/*
- build/macos/launcher-build.json
- build/macos-verification/result.json
- ${{ runner.temp }}/freevideo-smoke/smoke.json
- if-no-files-found: error
- retention-days: 7
- - name: Keep failure diagnostics
- if: failure()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: FreeVideo-Mac-build-failure-${{ github.sha }}
- path: |
- build/macos/build-result.json
- build/macos-verification/result.json
- ${{ runner.temp }}/freevideo-smoke/smoke.json
- if-no-files-found: ignore
- retention-days: 7
diff --git a/freevideo_engine/comfy_updates.py b/freevideo_engine/comfy_updates.py
index aad629b..d009ca3 100644
--- a/freevideo_engine/comfy_updates.py
+++ b/freevideo_engine/comfy_updates.py
@@ -37,7 +37,7 @@ def launcher_view(status):
"""The parts of a launcher status a page may show; None without a launcher."""
if not isinstance(status, dict):
return None
- view = {k: status.get(k) for k in ('version', 'phase', 'status', 'progress', 'candidate', 'engine', 'error', 'manual', 'channel')}
+ view = {k: status.get(k) for k in ('version', 'phase', 'status', 'progress', 'candidate', 'engine', 'error', 'manual', 'channel', 'track')}
view['phase'] = str(view['phase'] or '')
return view
@@ -55,6 +55,7 @@ class UpdateStatus:
current_version=current['version'] if current else None,
current_release=public_details(current) if current else installed_details(Path(__file__).parent),
channel=(current or {}).get('channel', launcher_update.CHANNEL),
+ track=launcher_update.build_track(current or {}),
available=None)
self.next_check = 0
self.client_seen = -1e9
@@ -85,6 +86,8 @@ class UpdateStatus:
if launcher is not None:
if launcher.get('channel') in (launcher_update.CHANNEL, launcher_update.MAC_CHANNEL):
state['channel'] = launcher['channel']
+ if launcher.get('track') in launcher_update.TRACKS:
+ state['track'] = launcher['track']
engine = launcher.get('engine') or {}
candidate = launcher.get('candidate') if isinstance(launcher.get('candidate'), dict) else None
available = (public_details(candidate) if candidate and candidate.get('version') else
@@ -97,10 +100,11 @@ class UpdateStatus:
def _check(self):
try:
channel = self.current.get('channel', launcher_update.CHANNEL)
- candidate = (launcher_update.latest_release() if channel == launcher_update.CHANNEL
- else launcher_update.latest_release(channel=channel))
+ track = launcher_update.build_track(self.current)
+ candidate = launcher_update.latest_release(channel=channel, track=track)
if (candidate.get('channel', launcher_update.CHANNEL) != channel
- or launcher_update.build_target(candidate) != launcher_update.build_target(self.current)):
+ or launcher_update.build_target(candidate) != launcher_update.build_target(self.current)
+ or launcher_update.build_track(candidate) != track):
raise ValueError('Update belongs to a different platform')
newer = (candidate['built_at'] > self.current['built_at']
and candidate['revision'] != self.current['revision'])
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index 1554f79..e4cc154 100644
--- a/freevideo_engine/launcher_session.py
+++ b/freevideo_engine/launcher_session.py
@@ -623,6 +623,7 @@ class Session:
current_release=public_details(self.updater.current) if self.updater else self.release_details,
installed=self.installed_version(), phase=self.update_phase(), key=key,
channel=self.updater.current.get('channel') if self.updater else None,
+ track=self.updater.current.get('track', 'stable') if self.updater else 'stable',
manual=bool(self.updater and self.updater.current.get('packaging') in ('onedir', 'app')))
due = ((view.get('candidate') and row['status'] in ('available', 'ready', 'error'))
or (view['engine'] and self.page == 'launcher'))
@@ -637,7 +638,7 @@ class Session:
from .release_notes import public_details
candidate = view.get('candidate') or {}
value = dict(version=__version__, phase=view['phase'], status=view.get('status'),
- progress=view.get('progress'), manual=view['manual'], channel=view['channel'],
+ progress=view.get('progress'), manual=view['manual'], channel=view['channel'], track=view['track'],
candidate=public_details(candidate) if candidate.get('version') else None,
engine=dict(view['current_release'], pending=view['engine'], installed=view['installed']),
error=str(view.get('error') or '')[:500])
diff --git a/freevideo_engine/launcher_update.py b/freevideo_engine/launcher_update.py
index 935324d..cfde21d 100644
--- a/freevideo_engine/launcher_update.py
+++ b/freevideo_engine/launcher_update.py
@@ -20,11 +20,19 @@ from .diagnostics import Redactor
from .monitoring import save
REPOSITORY = 'FlashML-org/FreeVideo'
+# The channel names the platform; launchers from before combined releases read
+# these tags, which the release workflow keeps up to date for them.
CHANNEL = 'windows-preview'
API = 'https://api.github.com/repos/' + REPOSITORY
-RELEASE_PAGE = 'https://github.com/' + REPOSITORY + '/releases/tag/' + CHANNEL
+RELEASE_PAGE = 'https://github.com/' + REPOSITORY + '/releases/latest'
MAX_EXE_BYTES = 512 * 2**20
MAC_CHANNEL = 'macos-preview'
+# Stable builds follow the latest vX.Y.Z release; nightly builds follow the
+# rolling `nightly` prerelease. Both carry every platform in one release.
+TRACKS = ('stable', 'nightly')
+NIGHTLY_TAG = 'nightly'
+RELEASE_ASSETS = {CHANNEL: ('FreeVideo.exe', 'update-windows.json'),
+ MAC_CHANNEL: ('FreeVideo-Mac-arm64.dmg', 'update-macos.json')}
def build_target(value):
@@ -32,8 +40,14 @@ def build_target(value):
return value.get('target', 'windows-x86_64')
+def build_track(value):
+ return value.get('track', 'stable')
+
+
def release_page(current):
- return 'https://github.com/' + REPOSITORY + '/releases/tag/' + build_identity(current)['channel']
+ if build_track(build_identity(current)) == 'nightly':
+ return 'https://github.com/' + REPOSITORY + '/releases/tag/' + NIGHTLY_TAG
+ return RELEASE_PAGE
def build_identity(value):
@@ -48,7 +62,11 @@ def build_identity(value):
raise ValueError('Invalid Mac launcher build identity')
elif build_target(value) != 'windows-x86_64':
raise ValueError('Launcher update channel does not match its target')
+ if build_track(value) not in TRACKS:
+ raise ValueError('Unknown launcher release track')
result = {k: value[k] for k in ('schema', 'repository', 'channel', 'revision', 'built_at', 'version')}
+ if build_track(value) != 'stable':
+ result['track'] = build_track(value)
if value.get('packaging') == 'onedir':
result['packaging'] = 'onedir'
if value['channel'] == MAC_CHANNEL:
@@ -80,7 +98,7 @@ def manifest(value):
def newer(candidate, current):
return (build_target(candidate) == build_target(current)
- and candidate['channel'] == current['channel']
+ and candidate['channel'] == current['channel'] and build_track(candidate) == build_track(current)
and candidate['revision'] != current['revision'] and candidate['built_at'] > current['built_at'])
@@ -141,29 +159,54 @@ def _json(url, token, *, binary=False, limit=2**20):
return json.loads(b''.join(_bytes(response, limit)))
-def latest_release(token='', *, channel=CHANNEL):
- """Read and validate the published build without downloading an executable."""
- if channel not in (CHANNEL, MAC_CHANNEL):
- raise ValueError('Unknown launcher update channel')
+def _release(token, channel, track):
+ """The release holding this platform's update, and its metadata asset name."""
+ executable, metadata = RELEASE_ASSETS[channel]
+ if track == 'nightly':
+ release = _json(API + '/releases/tags/' + NIGHTLY_TAG, token)
+ if not isinstance(release, dict) or release.get('draft') or release.get('tag_name') != NIGHTLY_TAG:
+ raise ValueError('No nightly build is published yet')
+ return release, executable, metadata
+ try:
+ release = _json(API + '/releases/latest', token)
+ except urllib.error.HTTPError as error:
+ if error.code != 404:
+ raise
+ release = None
+ names = {a.get('name') for a in (release or {}).get('assets', []) if isinstance(a, dict)}
+ if isinstance(release, dict) and not release.get('draft') and not release.get('prerelease') and metadata in names:
+ return release, executable, metadata
+ # Until the first combined release, updates come from the platform tag.
release = _json(API + '/releases/tags/' + channel, token)
if not isinstance(release, dict) or release.get('draft') or release.get('tag_name') != channel:
raise ValueError('No published update is available for this platform')
+ return release, executable, 'update.json'
+
+
+def latest_release(token='', *, channel=CHANNEL, track='stable'):
+ """Read and validate the published build without downloading an executable."""
+ if channel not in (CHANNEL, MAC_CHANNEL):
+ raise ValueError('Unknown launcher update channel')
+ if track not in TRACKS:
+ raise ValueError('Unknown launcher release track')
+ release, executable_name, metadata_name = _release(token, channel, track)
assets = {a.get('name'): a for a in release.get('assets', []) if isinstance(a, dict)}
- metadata, executable = assets.get('update.json', {}), assets.get(
- 'FreeVideo-Mac-arm64.dmg' if channel == MAC_CHANNEL else 'FreeVideo.exe', {})
+ metadata, executable = assets.get(metadata_name, {}), assets.get(executable_name, {})
if type(metadata.get('id')) is not int:
raise ValueError('Update metadata is not published yet; check the release page')
candidate = manifest(_json(API + '/releases/assets/' + str(metadata['id']), token, binary=True, limit=65536))
if candidate['channel'] != channel:
raise ValueError('Update metadata belongs to a different platform')
+ if build_track(candidate) != track:
+ raise ValueError('Update metadata belongs to a different release track')
if candidate['asset']['id'] != executable.get('id') or candidate['asset']['bytes'] != executable.get('size'):
raise ValueError('A new release is being published; check again shortly')
return candidate
def check(current, token=''):
- build_identity(current)
- candidate = latest_release(token) if current['channel'] == CHANNEL else latest_release(token, channel=current['channel'])
+ current = build_identity(current)
+ candidate = latest_release(token, channel=current['channel'], track=build_track(current))
return candidate if newer(candidate, current) else None
diff --git a/scripts/build_macos.py b/scripts/build_macos.py
index 92ac8d3..ab95e10 100644
--- a/scripts/build_macos.py
+++ b/scripts/build_macos.py
@@ -31,7 +31,7 @@ OPEN_GUIDE = '''FreeVideo for Mac — 首次打开 / First open
如果 macOS 提示无法验证开发者或无法检查恶意软件
这是因为预览版暂未进行 Apple 公证。放行前请先确认安装包来自官方:
-1. 只从 https://github.com/FlashML-org/FreeVideo/releases/tag/macos-preview 下载。
+1. 只从 https://github.com/FlashML-org/FreeVideo/releases 下载。
2. 在“终端”运行 shasum -a 256 ~/Downloads/FreeVideo-Mac-arm64.dmg,结果应与该页面 SHA256SUMS.txt 中的值一致。
然后:
3. 先尝试打开 FreeVideo,再关闭系统提示。
@@ -47,7 +47,7 @@ Install
If macOS cannot verify the developer or check the app for malicious software
This happens because the preview isn't notarized by Apple yet. Before approving it, make sure the file is the official one:
-1. Download it only from https://github.com/FlashML-org/FreeVideo/releases/tag/macos-preview.
+1. Download it only from https://github.com/FlashML-org/FreeVideo/releases.
2. In Terminal, run shasum -a 256 ~/Downloads/FreeVideo-Mac-arm64.dmg. The result should match the value in SHA256SUMS.txt on that page.
Then:
3. Try opening FreeVideo, then dismiss the system alert.
diff --git a/scripts/build_windows.py b/scripts/build_windows.py
index ca4aa38..2fdb67c 100644
--- a/scripts/build_windows.py
+++ b/scripts/build_windows.py
@@ -13,11 +13,19 @@ import time
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from freevideo_engine.desktop_runtime import check_launcher_dependencies, package_data_files, source_files
-from freevideo_engine.launcher_update import REPOSITORY, CHANNEL
+from freevideo_engine.launcher_update import REPOSITORY, CHANNEL, TRACKS
from freevideo_engine.release_notes import catalog, markdown
from scripts.build_launcher_notices import collect as collect_notices
+def release_track():
+ """Nightly builds are made with FREEVIDEO_RELEASE_TRACK=nightly; stable identities stay unchanged."""
+ track = os.environ.get('FREEVIDEO_RELEASE_TRACK') or 'stable'
+ if track not in TRACKS:
+ raise SystemExit('FREEVIDEO_RELEASE_TRACK must be one of ' + ', '.join(TRACKS))
+ return {} if track == 'stable' else {'track': track}
+
+
def build_info(root):
try:
revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=root, text=True,
@@ -29,7 +37,7 @@ def build_info(root):
# Numeric UTC date + HHMMSS is also a valid Python package version.
version = '.'.join(str(int(part)) for part in time.strftime('%Y.%m.%d.%H%M%S', time.gmtime(built_at)).split('.'))
return dict(schema=1, repository=REPOSITORY, channel=CHANNEL, revision=revision,
- built_at=built_at, version=version, **catalog(root / 'freevideo_engine'))
+ built_at=built_at, version=version, **release_track(), **catalog(root / 'freevideo_engine'))
def stamp_source(staged, identity):
diff --git a/scripts/publish_release.py b/scripts/publish_release.py
new file mode 100644
index 0000000..a76c5ad
--- /dev/null
+++ b/scripts/publish_release.py
@@ -0,0 +1,294 @@
+"""Publish the built launchers: the rolling nightly, or a stable vX.Y.Z release for every platform.
+
+The release workflow runs this after the Windows and Mac jobs. A stable release also refreshes the
+platform tags (windows-preview, macos-preview) that launchers from before combined releases read.
+Writes go through the gh CLI with retries. Update metadata is uploaded last and bound to the
+immutable asset IDs, so a reader never pairs new metadata with an old executable.
+Usage: publish_release.py --track stable|nightly --windows DIR --macos DIR --sha COMMIT
+"""
+import argparse
+import hashlib
+import json
+import os
+from pathlib import Path
+import re
+import subprocess
+import sys
+import tempfile
+import time
+
+ROOT = Path(__file__).resolve().parents[1]
+sys.path.insert(0, str(ROOT))
+from freevideo_engine.launcher_update import (CHANNEL, MAC_CHANNEL, NIGHTLY_TAG, RELEASE_ASSETS, # noqa: E402
+ build_identity, build_track)
+from freevideo_engine.release_notes import notes # noqa: E402
+
+PLATFORMS = (CHANNEL, MAC_CHANNEL)
+PAGE = 'https://github.com/FlashML-org/FreeVideo'
+LOGO = '''<div align="center">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://freevideo-community.pages.dev/logo-dark.svg">
+ <img alt="FreeVideo" src="https://freevideo-community.pages.dev/logo-light.svg" width="55%">
+ </picture>
+</div>
+'''
+COMMUNITY = ('[Discord](https://discord.gg/MsA277cJzZ) · [QQ Group / QQ 群](https://freevideo-community.pages.dev/qq)'
+ ' · [WeChat Group / 微信群](https://freevideo-community.pages.dev/wechat)')
+
+
+def gh(label, *args, parse=False):
+ """Run gh; retry transient failures, including empty or truncated JSON."""
+ for attempt in range(1, 4):
+ print('%s (attempt %d/3)' % (label, attempt), file=sys.stderr, flush=True)
+ try:
+ done = subprocess.run(['gh', *args], capture_output=True, text=True, timeout=300)
+ except subprocess.TimeoutExpired:
+ done = None
+ if done is not None and done.returncode == 0:
+ if not parse:
+ return done.stdout
+ try:
+ return json.loads(done.stdout)
+ except ValueError:
+ print('%s returned incomplete JSON; retrying the read' % label, file=sys.stderr)
+ elif done is not None:
+ sys.stderr.write(done.stderr)
+ if attempt < 3:
+ time.sleep(2 * attempt)
+ raise SystemExit('::error::%s failed after 3 attempts' % label)
+
+
+def digest(path):
+ value = hashlib.sha256()
+ with Path(path).open('rb') as stream:
+ for block in iter(lambda: stream.read(1 << 20), b''):
+ value.update(block)
+ return value.hexdigest()
+
+
+def load_builds(windows, macos):
+ builds = {}
+ for channel, folder in ((CHANNEL, Path(windows)), (MAC_CHANNEL, Path(macos))):
+ raw = json.loads((folder / 'launcher-build.json').read_text(encoding='utf-8'))
+ identity = build_identity(raw)
+ if identity['channel'] != channel:
+ raise SystemExit('%s holds a %s build' % (folder, identity['channel']))
+ executable = folder / RELEASE_ASSETS[channel][0]
+ if not executable.is_file():
+ raise SystemExit('Missing %s' % executable)
+ builds[channel] = dict(raw=raw, identity=identity, path=executable, sha256=digest(executable))
+ versions = {b['identity'].get('product_version') for b in builds.values()}
+ tracks = {build_track(b['identity']) for b in builds.values()}
+ if len(versions) != 1 or None in versions:
+ raise SystemExit('Windows and Mac builds must carry the same product version: %s' % sorted(map(str, versions)))
+ if len(tracks) != 1:
+ raise SystemExit('Windows and Mac builds come from different release tracks')
+ return builds
+
+
+def escape(text):
+ return re.sub(r'([\\`*_{}\[\]()#+.!<>|~-])', r'\\\1', text)
+
+
+def whats_new(raw):
+ release = notes(raw.get('release_notes'))
+ if not release:
+ raise SystemExit('The build has no bilingual release notes')
+ rows = []
+ for language, heading in (('en', "What's new"), ('zh', '更新内容')):
+ rows += ['## ' + heading, '', escape(release[language]['summary']), '']
+ rows += ['- ' + escape(item) for item in release[language]['changes']] + ['']
+ return rows
+
+
+def stable_body(builds, tag):
+ download = PAGE + '/releases/download/' + tag + '/'
+ windows, mac = (builds[c]['raw']['version'] for c in PLATFORMS)
+ rows = ['# FreeVideo ' + tag, '', 'Windows build / 构建号 ' + escape(windows) + ' · Mac ' + escape(mac), '']
+ rows += whats_new(builds[CHANNEL]['raw'])
+ rows += [LOGO, '## Download / 下载', '',
+ '| | |', '|---|---|',
+ '| **Windows** 10/11 · NVIDIA GPU | [FreeVideo.exe](%sFreeVideo.exe) |' % download,
+ '| **macOS** 14+ · Apple silicon (preview / 预览版) | [FreeVideo-Mac-arm64.dmg](%sFreeVideo-Mac-arm64.dmg) |' % download,
+ '',
+ '**Windows:** run FreeVideo.exe, select an existing ComfyUI folder or install a new one, then click **Install & launch**. '
+ 'Offline packages are on [Quark](https://pan.quark.cn/s/c51235b84618).',
+ '',
+ '**Mac:** open the DMG and drag FreeVideo.app into Applications. The preview is not notarized yet, so check the file '
+ 'against SHA256SUMS.txt and follow the [first-open steps](%s/blob/main/docs/Mac.md#first-open).' % PAGE,
+ '',
+ '**Windows:** 运行 FreeVideo.exe,选择已有的 ComfyUI 或安装新的 ComfyUI,点击 **安装并启动**。'
+ '离线包见[夸克网盘](https://pan.quark.cn/s/c51235b84618)。',
+ '',
+ '**Mac:** 打开 DMG,将 FreeVideo.app 拖入「应用程序」。预览版暂未进行 Apple 公证,请先用 SHA256SUMS.txt 核对文件,'
+ '再按[首次打开步骤](%s/blob/main/docs/Mac.zh-CN.md#首次打开)操作。' % PAGE,
+ '', COMMUNITY, '']
+ return '\n'.join(rows)
+
+
+def nightly_body(builds, sha):
+ built = time.strftime('%Y-%m-%d %H:%M', time.gmtime(max(b['identity']['built_at'] for b in builds.values())))
+ size = {c: '%.1f MB' % (builds[c]['path'].stat().st_size / 1e6) for c in PLATFORMS}
+ sums = '\n'.join('%s %s' % (builds[c]['sha256'], builds[c]['path'].name) for c in PLATFORMS)
+ return '\n'.join([
+ '## FreeVideo nightly (rolling)', '',
+ 'Automated build of `main`, replaced after every merge. Launchers never update to it: they follow the latest '
+ '[vX.Y.Z release](%s/releases/latest). The Windows launcher here is not code-signed and the Mac app is not notarized.' % PAGE,
+ '',
+ '自动构建 `main` 的最新提交,每次合并都会替换。启动器不会自动更新到这里,只跟随最新的 [vX.Y.Z 正式版](%s/releases/latest)。'
+ '这里的 Windows 启动器未签名,Mac 应用未公证。' % PAGE,
+ '',
+ '| commit | built (UTC) | version | Windows | Mac |', '|---|---|---|---|---|',
+ '| [`%s`](%s/commit/%s) | %s | %s | %s | %s |' % (sha[:9], PAGE, sha, built,
+ escape('v' + builds[CHANNEL]['identity']['product_version']),
+ size[CHANNEL], size[MAC_CHANNEL]),
+ '', '<details><summary>sha256</summary>', '', '```', sums, '```', '</details>', ''])
+
+
+class Releases:
+ def __init__(self, repository):
+ self.repository = repository
+
+ def api(self, label, path, *args, parse=True):
+ return gh(label, 'api', *args, 'repos/%s/%s' % (self.repository, path), parse=parse)
+
+ def tag_exists(self, tag):
+ refs = self.api('Read tag %s' % tag, 'git/matching-refs/tags/' + tag)
+ return any(r.get('ref') == 'refs/tags/' + tag for r in refs)
+
+ def point_tag(self, tag, sha):
+ if self.tag_exists(tag):
+ self.api('Move tag %s' % tag, 'git/refs/tags/' + tag, '-X', 'PATCH', '-f', 'sha=' + sha, '-F', 'force=true')
+ else:
+ gh('Create tag %s' % tag, 'api', '-X', 'POST', 'repos/%s/git/refs' % self.repository,
+ '-f', 'ref=refs/tags/' + tag, '-f', 'sha=' + sha, parse=True)
+
+ def find(self, tag):
+ pages = gh('Read releases including drafts', 'api', '--paginate', '--slurp',
+ 'repos/%s/releases?per_page=100' % self.repository, parse=True)
+ return next((r for page in pages for r in page if r.get('tag_name') == tag), None)
+
+ def assets(self, tag):
+ release = self.find(tag)
+ if release is None:
+ raise SystemExit('Release %s disappeared while publishing' % tag)
+ return {a['name']: a for a in self.api('Read %s assets' % tag, 'releases/%d' % release['id'])['assets']}
+
+
+def metadata(build, asset, path):
+ if asset['size'] != build['path'].stat().st_size:
+ raise SystemExit('Uploaded %s differs in size from the built file' % asset['name'])
+ value = dict(build['raw'], asset=dict(id=asset['id'], bytes=asset['size'], sha256=build['sha256']))
+ Path(path).write_text(json.dumps(value, indent=2), encoding='utf-8')
+ return path
+
+
+def write(folder, name, text):
+ path = Path(folder) / name
+ path.write_text(text, encoding='utf-8')
+ return str(path)
+
+
+def bind_metadata(releases, tag, builds, channels, folder, names):
+ """Upload update metadata for each platform, bound to the assets now on the release."""
+ uploaded = releases.assets(tag)
+ files = [metadata(builds[c], uploaded[builds[c]['path'].name], Path(folder) / names[c]) for c in channels]
+ gh('Upload update metadata to %s' % tag, 'release', 'upload', tag, *map(str, files), '--clobber')
+
+
+def publish_stable(releases, builds, sha, folder):
+ version = builds[CHANNEL]['identity']['product_version']
+ tag = 'v' + version
+ if releases.tag_exists(tag) or releases.find(tag) is not None:
+ raise SystemExit('::error::%s is already released. Bump product_version and the notes in '
+ 'freevideo_engine/release_notes.json, merge, then publish again.' % tag)
+ sums = write(folder, 'SHA256SUMS.txt', ''.join('%s %s\n' % (builds[c]['sha256'], builds[c]['path'].name) for c in PLATFORMS))
+ body = write(folder, 'release-body.md', stable_body(builds, tag))
+ title = 'FreeVideo ' + tag
+ releases.point_tag(tag, sha)
+ gh('Create draft %s' % tag, 'release', 'create', tag, '--verify-tag', '--draft', '--title', title, '--notes-file', body)
+ gh('Upload launchers to %s' % tag, 'release', 'upload', tag, *(str(builds[c]['path']) for c in PLATFORMS), sums, '--clobber')
+ bind_metadata(releases, tag, builds, PLATFORMS, folder, {c: RELEASE_ASSETS[c][1] for c in PLATFORMS})
+ gh('Publish %s' % tag, 'release', 'edit', tag, '--draft=false', '--prerelease=false', '--latest',
+ '--title', title, '--notes-file', body)
+ # Launchers from before combined releases read the platform tags; keep them current.
+ for channel in PLATFORMS:
+ build = builds[channel]
+ name = 'Windows' if channel == CHANNEL else 'Mac'
+ legacy = write(folder, 'legacy-%s.md' % channel,
+ 'This page serves update checks for launchers older than %s. Download FreeVideo from the '
+ '[latest release](%s/releases/latest).\n\n此页面仅供旧版启动器检查更新,请从'
+ '[最新正式版](%s/releases/latest)下载。\n' % (tag, PAGE, PAGE))
+ legacy_sums = write(folder, 'SHA256SUMS-%s.txt' % channel, '%s %s\n' % (build['sha256'], build['path'].name))
+ releases.point_tag(channel, sha)
+ if releases.find(channel) is None:
+ gh('Create %s' % channel, 'release', 'create', channel, '--verify-tag', '--prerelease', '--latest=false',
+ '--title', 'FreeVideo %s for %s' % (tag, name), '--notes-file', legacy)
+ staged = Path(folder) / channel
+ staged.mkdir(exist_ok=True)
+ (staged / 'SHA256SUMS.txt').write_bytes(Path(legacy_sums).read_bytes())
+ gh('Upload %s launcher' % channel, 'release', 'upload', channel, str(build['path']),
+ str(staged / 'SHA256SUMS.txt'), '--clobber')
+ bind_metadata(releases, channel, builds, (channel,), staged, {channel: 'update.json'})
+ gh('Describe %s' % channel, 'release', 'edit', channel, '--draft=false', '--prerelease', '--latest=false',
+ '--title', 'FreeVideo %s for %s' % (tag, name), '--notes-file', legacy)
+ print('Published %s/releases/tag/%s' % (PAGE, tag))
+
+
+def ignored(path):
+ # Changes that never trigger a build (see the workflow's push paths-ignore).
+ return path.endswith('.md') or path.startswith('.github/')
+
+
+def superseded(releases, sha):
+ main = releases.api('Read current main', 'git/ref/heads/main')['object']['sha']
+ if main == sha:
+ return False
+ comparison = releases.api('Compare with current main', 'compare/%s...%s' % (sha, main))
+ files = comparison.get('files')
+ later_only_ignored = (comparison.get('status') == 'ahead'
+ and comparison.get('merge_base_commit', {}).get('sha') == sha
+ and isinstance(files, list) and files
+ and all(ignored(f.get('filename', '')) and ignored(f.get('previous_filename', f.get('filename', '')))
+ for f in files))
+ return not later_only_ignored
+
+
+def publish_nightly(releases, builds, sha, folder):
+ if superseded(releases, sha):
+ print('main moved on; the newer build publishes the nightly')
+ return
+ sums = write(folder, 'SHA256SUMS.txt', ''.join('%s %s\n' % (builds[c]['sha256'], builds[c]['path'].name) for c in PLATFORMS))
+ body = write(folder, 'release-body.md', nightly_body(builds, sha))
+ releases.point_tag(NIGHTLY_TAG, sha)
+ if releases.find(NIGHTLY_TAG) is None:
+ gh('Create nightly', 'release', 'create', NIGHTLY_TAG, '--verify-tag', '--draft', '--prerelease', '--latest=false',
+ '--title', 'Nightly (rolling)', '--notes-file', body)
+ gh('Upload nightly launchers', 'release', 'upload', NIGHTLY_TAG, *(str(builds[c]['path']) for c in PLATFORMS), sums, '--clobber')
+ bind_metadata(releases, NIGHTLY_TAG, builds, PLATFORMS, folder, {c: RELEASE_ASSETS[c][1] for c in PLATFORMS})
+ keep = {builds[c]['path'].name for c in PLATFORMS} | {RELEASE_ASSETS[c][1] for c in PLATFORMS} | {'SHA256SUMS.txt'}
+ for name in sorted(set(releases.assets(NIGHTLY_TAG)) - keep):
+ gh('Remove stale %s' % name, 'release', 'delete-asset', NIGHTLY_TAG, name, '--yes')
+ gh('Publish nightly', 'release', 'edit', NIGHTLY_TAG, '--draft=false', '--prerelease', '--latest=false',
+ '--title', 'Nightly (rolling)', '--notes-file', body)
+ print('Published %s/releases/tag/%s' % (PAGE, NIGHTLY_TAG))
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--track', choices=('stable', 'nightly'), required=True)
+ parser.add_argument('--windows', type=Path, required=True)
+ parser.add_argument('--macos', type=Path, required=True)
+ parser.add_argument('--sha', required=True)
+ parser.add_argument('--repository', default=os.environ.get('GH_REPO', 'FlashML-org/FreeVideo'))
+ args = parser.parse_args()
+ builds = load_builds(args.windows, args.macos)
+ if build_track(builds[CHANNEL]['identity']) != args.track:
+ raise SystemExit('The builds are %s builds, not %s' % (build_track(builds[CHANNEL]['identity']), args.track))
+ releases = Releases(args.repository)
+ with tempfile.TemporaryDirectory(prefix='freevideo-publish-') as folder:
+ (publish_stable if args.track == 'stable' else publish_nightly)(releases, builds, args.sha, folder)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/web/updates.js b/web/updates.js
index a3f2af4..10dcbce 100644
--- a/web/updates.js
+++ b/web/updates.js
@@ -1,7 +1,8 @@
import { api } from '../../scripts/api.js';
-const releasePage = 'https://github.com/FlashML-org/FreeVideo/releases/tag/windows-preview';
-const macReleasePage = 'https://github.com/FlashML-org/FreeVideo/releases/tag/macos-preview';
+// Every platform downloads from one release: the latest vX.Y.Z, or the rolling nightly.
+const releasePage = 'https://github.com/FlashML-org/FreeVideo/releases/latest';
+const nightlyPage = 'https://github.com/FlashML-org/FreeVideo/releases/tag/nightly';
const storageKey = 'freevideo.dismissed-update';
const listeners = new Set();
// Launcher phases during which the server may disappear and come back updated.
@@ -121,7 +122,7 @@ export function createUpdateNotice(cn) {
const render = () => {
const launcher = value?.launcher, phase = launcher?.phase || '', candidate = value?.available;
const mac = value?.channel === 'macos-preview';
- link.href = mac ? macReleasePage : releasePage;
+ link.href = value?.track === 'nightly' ? nightlyPage : releasePage;
link.title = mac
? t('After your task finishes, open the new FreeVideo.app to update.', '当前任务完成后,打开新版 FreeVideo.app 更新。')
: t('After your task finishes, open the new FreeVideo.exe to update.', '当前任务完成后,打开新版 FreeVideo.exe 更新。');