ci(desktop): split updater into stable (desktop-latest) + edge (desktop-edge) channels

The installed desktop app polls `desktop-latest/latest.json`. Previously
every push to `main` (autotag -> v*.devN -> desktop.yml dispatch) rebuilt
and republished `desktop-latest` as a DEV prerelease, so stable users were
auto-updated onto unvetted dev builds, and any manual stable mirror was
clobbered on the next merge.

Split the streams so the app's channel only ever serves vetted stable:

- Dev/rolling builds (v* autotag + manual workflow_dispatch) now publish to
  a new `desktop-edge` pre-release. The shipped app does not poll edge, so
  dev builds never auto-install onto stable users.
- Stable `desktop-v*` builds publish the user-facing release as before, then
  a new `refresh-stable-channel` job copies that release's signed
  `latest.json` into `desktop-latest` (mirror; URLs already point at the
  desktop-v* assets). Cut a `desktop-v*` tag to ship an update.
- `clean-release` now targets `desktop-edge`; `desktop-latest` is never
  wiped by CI.

No app/tauri.conf.json change — the updater endpoint stays `desktop-latest`.
Doc updated to describe the now-implemented stable/edge split.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
krypticmouse
2026-05-25 23:36:17 +00:00
co-authored by Claude Opus 4.7
parent cdae426d48
commit e3f2b008d2
2 changed files with 75 additions and 23 deletions
+53 -8
View File
@@ -73,19 +73,20 @@ jobs:
working-directory: frontend/src-tauri
run: cargo test
# Remove stale artifacts from the desktop-latest pre-release so that
# only the current build's files are available for download.
# Remove stale artifacts from the desktop-edge rolling pre-release so that
# only the current build's files are available for download. (The stable
# `desktop-latest` channel the installed app polls is never cleaned here.)
clean-release:
needs: [validate]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Delete old assets from desktop-latest
- name: Delete old assets from desktop-edge
if: "!startsWith(github.ref, 'refs/tags/')"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="desktop-latest"
TAG="desktop-edge"
# List all asset IDs on the release and delete them
ASSET_IDS=$(gh api "repos/${{ github.repository }}/releases/tags/${TAG}" \
--jq '.assets[].id' 2>/dev/null || true)
@@ -170,10 +171,13 @@ jobs:
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
# Auto-tagged rolling build from autotag.yml — use the same
# version as the CLI/PyPI release so all surfaces stay in sync.
# Rolling/dev builds go to the `desktop-edge` channel, NOT the
# `desktop-latest` channel the installed app polls — so users on
# stable are never auto-updated onto an unvetted dev build.
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}"
echo "tag=desktop-latest" >> "$GITHUB_OUTPUT"
echo "name=Desktop (Latest Build)" >> "$GITHUB_OUTPUT"
echo "tag=desktop-edge" >> "$GITHUB_OUTPUT"
echo "name=Desktop (Edge Build)" >> "$GITHUB_OUTPUT"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
# workflow_dispatch fallback (manual UI dispatch without --ref).
@@ -186,8 +190,9 @@ jobs:
NEXT_PATCH=$((PATCH + 1))
BUILD=$(git rev-list --count HEAD)
VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}.dev${BUILD}"
echo "tag=desktop-latest" >> "$GITHUB_OUTPUT"
echo "name=Desktop (Latest Build)" >> "$GITHUB_OUTPUT"
# Manual dispatches are also dev builds -> the edge channel.
echo "tag=desktop-edge" >> "$GITHUB_OUTPUT"
echo "name=Desktop (Edge Build)" >> "$GITHUB_OUTPUT"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
@@ -243,3 +248,43 @@ jobs:
prerelease: ${{ steps.release-info.outputs.prerelease }}
includeUpdaterJson: true
args: ${{ matrix.args }}
# When a stable `desktop-v*` release is published, repoint the
# `desktop-latest` auto-update channel (the endpoint the installed app
# polls) at it. The stable release's own `latest.json` already references
# this release's signed assets, so we copy it verbatim — installed apps are
# only ever offered vetted stable builds, never `desktop-edge` dev builds.
refresh-stable-channel:
needs: [build-and-release]
if: startsWith(github.ref, 'refs/tags/desktop-v')
runs-on: ubuntu-latest
steps:
- name: Mirror stable latest.json into desktop-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STABLE_TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
# The stable release's updater manifest may take a moment to become
# downloadable after tauri-action publishes it; retry briefly.
URL="https://github.com/${REPO}/releases/download/${STABLE_TAG}/latest.json"
for attempt in 1 2 3 4 5; do
if curl -fsSL -o latest.json "$URL"; then
echo "Fetched ${STABLE_TAG}/latest.json on attempt ${attempt}"
break
fi
echo "latest.json not ready yet (attempt ${attempt}); sleeping 15s"
sleep 15
done
test -s latest.json || { echo "::error::Could not fetch ${URL}"; exit 1; }
# Ensure the channel release exists (prerelease so it never usurps
# the stable "Latest" badge), then replace its manifest in place.
if ! gh release view desktop-latest --repo "$REPO" >/dev/null 2>&1; then
gh release create desktop-latest --repo "$REPO" \
--prerelease \
--title "Desktop Auto-Update Channel" \
--notes "Auto-update channel pointer for the desktop app. Mirrors the latest stable \`desktop-v*\` release; the in-app updater polls this \`latest.json\`. Download the app from the latest stable release, not here."
fi
gh release upload desktop-latest latest.json --repo "$REPO" --clobber
echo "desktop-latest now mirrors ${STABLE_TAG}"