Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci(spaces): nightly channel on every platform, CI gate, no more betas (CUA-3503) (#6545)

cua-agents[bot]d15cc5727d29
diff --git a/.github/scripts/spaces_nightly_gate.py b/.github/scripts/spaces_nightly_gate.py
new file mode 100644
index 0000000000..4975bf99d7
--- /dev/null
+++ b/.github/scripts/spaces_nightly_gate.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python3
+"""Is main's Spaces CI green at this commit? The gate of nightly-cua-spaces.yml.
+
+The nightly builds main's head only when the Spaces CI workflows
+(.github/workflows/ci-cua-spaces*.yml, which run on every push to main that
+touches their paths) passed on it. A commit that ran none of them (it changed
+nothing Spaces reads) has the CI state of the newest first-parent ancestor
+that ran them, so the walk goes back until it finds one.
+
+ python3 spaces_nightly_gate.py OWNER/REPO SHA [--wait-minutes N]
+
+Prints `green`, `red` or `pending` (pending only once the wait ran out) and,
+for red, the failed workflows on stderr. Exit code 0 in every case: the
+caller decides. Needs GH_TOKEN and a git checkout with the history.
+
+`cancelled` runs do not count: main's CI cancels a run a newer push
+supersedes, and that says nothing about the code.
+"""
+import json
+import os
+import re
+import subprocess
+import sys
+import time
+import urllib.request
+
+SPACES_CI = re.compile(r"^\.github/workflows/ci-cua-spaces[\w.-]*\.ya?ml$")
+RED = {"failure", "timed_out", "startup_failure", "action_required"}
+# How far back a commit's CI state is looked for before the gate gives up.
+MAX_WALK = 60
+
+
+def spaces_runs(runs):
+ """The push runs of the Spaces CI workflows, the newest of each (a re-run keeps its id)."""
+ newest = {}
+ for run in runs:
+ if run.get("event") != "push" or not SPACES_CI.match(run.get("path") or ""):
+ continue
+ if run["path"] not in newest or run["id"] > newest[run["path"]]["id"]:
+ newest[run["path"]] = run
+ return list(newest.values())
+
+
+def verdict(runs):
+ """`green`, `red`, `pending` or `none` (no Spaces CI ran) for one commit's runs."""
+ mine = spaces_runs(runs)
+ if not mine:
+ return "none", []
+ failed = sorted(r["path"].rsplit("/", 1)[-1] for r in mine if r.get("status") == "completed" and r.get("conclusion") in RED)
+ if failed:
+ return "red", failed
+ if any(r.get("status") != "completed" for r in mine):
+ return "pending", []
+ return "green", []
+
+
+def _runs_for(repo, sha):
+ req = urllib.request.Request(
+ f"https://api.github.com/repos/{repo}/actions/runs?head_sha={sha}&event=push&per_page=100",
+ headers={"Authorization": f"Bearer {os.environ['GH_TOKEN']}", "Accept": "application/vnd.github+json"},
+ )
+ with urllib.request.urlopen(req, timeout=60) as resp:
+ return json.load(resp)["workflow_runs"]
+
+
+def commit_state(repo, sha, fetch=_runs_for, parents=None):
+ """The Spaces CI verdict of `sha`, from the newest first-parent ancestor that ran it."""
+ if parents is None:
+ parents = subprocess.run(
+ ["git", "rev-list", "--first-parent", f"--max-count={MAX_WALK}", sha],
+ check=True, capture_output=True, text=True,
+ ).stdout.split()
+ for commit in parents:
+ state, failed = verdict(fetch(repo, commit))
+ if state != "none":
+ return state, failed, commit
+ return "pending", [], None
+
+
+def main(argv):
+ args = argv[1:]
+ wait = 0
+ if "--wait-minutes" in args:
+ i = args.index("--wait-minutes")
+ wait = int(args[i + 1])
+ del args[i:i + 2]
+ if len(args) != 2:
+ print(__doc__.strip(), file=sys.stderr)
+ return 2
+ repo, sha = args
+ deadline = time.monotonic() + wait * 60
+ while True:
+ state, failed, at = commit_state(repo, sha)
+ if state != "pending" or time.monotonic() >= deadline:
+ break
+ time.sleep(60)
+ if at and at != sha:
+ print(f"Spaces CI state taken from {at[:7]} (the newest commit that ran it)", file=sys.stderr)
+ for name in failed:
+ print(f"failed: {name}", file=sys.stderr)
+ print(state)
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/.github/scripts/sparkle_feed.py b/.github/scripts/sparkle_feed.py
index aa7231cc8f..563c7973d7 100644
--- a/.github/scripts/sparkle_feed.py
+++ b/.github/scripts/sparkle_feed.py
@@ -7,6 +7,7 @@ newest *untagged* item by <sparkle:version>, not the first item in the file.
python3 sparkle_feed.py check FEED.xml # exit 1 if any item is on the wrong channel
python3 sparkle_feed.py stable FEED.xml # print the version Stable apps are offered
+ python3 sparkle_feed.py nightly FEED.xml # exit 1 unless every item is a nightly (the nightly appcast)
`check` is the invariant that keeps prereleases off Stable: an X.Y.Z-nightly...
item must carry `nightly`, any other X.Y.Z-suffix item `beta`, and a plain
@@ -56,6 +57,18 @@ def violations(xml_text):
return bad
+def nightly_violations(xml_text):
+ """Why the nightly appcast (cua-spaces-nightly-appcast.xml) is wrong: it may
+ only hold X.Y.Z-nightly items on the `nightly` channel, never a stable or
+ beta item (an app on Nightly would take it as the newest nightly)."""
+ bad = violations(xml_text)
+ for item in _items(xml_text):
+ v = _short(item)
+ if want_channel(v) != "nightly":
+ bad.append("%s is not a nightly" % (v or "(no version)"))
+ return bad
+
+
def stable_version(xml_text):
"""The version an app on Stable is offered, or None."""
items = [i for i in _items(xml_text) if _channel(i) is None]
@@ -63,7 +76,7 @@ def stable_version(xml_text):
def main(argv):
- if len(argv) != 3 or argv[1] not in ("check", "stable"):
+ if len(argv) != 3 or argv[1] not in ("check", "stable", "nightly"):
print(__doc__.strip(), file=sys.stderr)
return 2
with open(argv[2], encoding="utf-8") as f:
@@ -71,7 +84,7 @@ def main(argv):
if argv[1] == "stable":
print(stable_version(text) or "")
return 0
- bad = violations(text)
+ bad = nightly_violations(text) if argv[1] == "nightly" else violations(text)
for b in bad:
print("::error::Sparkle appcast: %s" % b)
if bad:
diff --git a/.github/scripts/tests/test_spaces_nightly_gate.py b/.github/scripts/tests/test_spaces_nightly_gate.py
new file mode 100644
index 0000000000..94e685ff3d
--- /dev/null
+++ b/.github/scripts/tests/test_spaces_nightly_gate.py
@@ -0,0 +1,63 @@
+"""Run: python3 .github/scripts/tests/test_spaces_nightly_gate.py (CUA-3503)."""
+
+import sys
+import unittest
+from pathlib import Path
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+import spaces_nightly_gate as gate # noqa: E402
+
+
+def run(name, status="completed", conclusion="success", event="push", id=1):
+ return {"id": id, "path": f".github/workflows/{name}", "event": event, "status": status, "conclusion": conclusion}
+
+
+class Verdict(unittest.TestCase):
+ def test_all_spaces_ci_green(self):
+ runs = [run("ci-cua-spaces.yml"), run("ci-cua-spaces-web.yml"), run("ci-cua-spacesd.yml")]
+ self.assertEqual(gate.verdict(runs), ("green", []))
+
+ def test_a_failed_spaces_workflow_is_red(self):
+ runs = [run("ci-cua-spaces.yml"), run("ci-cua-spaces-macos.yml", conclusion="failure")]
+ self.assertEqual(gate.verdict(runs), ("red", ["ci-cua-spaces-macos.yml"]))
+
+ def test_red_wins_over_pending(self):
+ runs = [run("ci-cua-spaces-web.yml", conclusion="timed_out"), run("ci-cua-spaces.yml", status="in_progress", conclusion=None)]
+ self.assertEqual(gate.verdict(runs)[0], "red")
+
+ def test_running_is_pending(self):
+ runs = [run("ci-cua-spaces.yml"), run("ci-cua-spaces-rust-slice.yml", status="queued", conclusion=None)]
+ self.assertEqual(gate.verdict(runs), ("pending", []))
+
+ def test_other_workflows_and_events_do_not_count(self):
+ runs = [
+ run("ci-rust.yml", conclusion="failure"),
+ run("cd-cua-spaces-build.yml", conclusion="failure"),
+ run("ci-cua-spaces.yml", event="pull_request", conclusion="failure"),
+ ]
+ self.assertEqual(gate.verdict(runs), ("none", []))
+
+ def test_cancelled_is_not_red(self):
+ self.assertEqual(gate.verdict([run("ci-cua-spaces.yml", conclusion="cancelled")]), ("green", []))
+
+ def test_newest_run_of_a_workflow_wins(self):
+ runs = [run("ci-cua-spaces.yml", conclusion="failure", id=1), run("ci-cua-spaces.yml", id=2)]
+ self.assertEqual(gate.verdict(runs), ("green", []))
+
+
+class CommitState(unittest.TestCase):
+ def test_walks_back_to_the_newest_commit_that_ran_spaces_ci(self):
+ history = {"c3": [run("ci-rust.yml")], "c2": [run("ci-cua-spaces.yml", conclusion="failure")], "c1": [run("ci-cua-spaces.yml")]}
+ state, failed, at = gate.commit_state("o/r", "c3", fetch=lambda _r, c: history[c], parents=["c3", "c2", "c1"])
+ self.assertEqual((state, failed, at), ("red", ["ci-cua-spaces.yml"], "c2"))
+
+ def test_head_with_its_own_runs(self):
+ history = {"c2": [run("ci-cua-spaces.yml")], "c1": [run("ci-cua-spaces.yml", conclusion="failure")]}
+ self.assertEqual(gate.commit_state("o/r", "c2", fetch=lambda _r, c: history[c], parents=["c2", "c1"])[0], "green")
+
+ def test_nothing_found_is_pending(self):
+ self.assertEqual(gate.commit_state("o/r", "c1", fetch=lambda _r, _c: [], parents=["c1"])[0], "pending")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_spaces_nightly_wiring.py b/.github/scripts/tests/test_spaces_nightly_wiring.py
new file mode 100644
index 0000000000..109ba85756
--- /dev/null
+++ b/.github/scripts/tests/test_spaces_nightly_wiring.py
@@ -0,0 +1,73 @@
+"""The Cua Spaces nightly channel stays apart from stable (CUA-3503).
+
+Run: python3 -m pytest .github/scripts/tests/test_spaces_nightly_wiring.py
+"""
+from pathlib import Path
+import re
+
+ROOT = Path(__file__).resolve().parents[3]
+WORKFLOWS = ROOT / ".github/workflows"
+
+
+def source(name: str) -> str:
+ return (WORKFLOWS / name).read_text()
+
+
+def test_nightly_publishes_only_to_its_own_rolling_prerelease():
+ nightly = source("nightly-cua-spaces.yml")
+ assert " TAG: cua-spaces-nightly\n" in nightly
+ # Every release write goes to $TAG; the stable release is only read.
+ for line in re.findall(r"gh release (?:upload|create|edit|delete-asset)[^\n]*", nightly):
+ assert '"$TAG"' in line, line
+ assert "cua-spaces-latest" not in "".join(re.findall(r"gh release (?:upload|create|edit|delete-asset)[^\n]*", nightly))
+ # Never Latest, always a prerelease.
+ assert "--prerelease --latest=false" in nightly
+ assert nightly.count("--latest=false") == 2
+ assert "--latest=true" not in nightly and "make_latest" not in nightly
+
+
+def test_nightly_checks_its_feeds_and_the_stable_ones():
+ nightly = source("nightly-cua-spaces.yml")
+ assert "sparkle_feed.py nightly" in nightly
+ assert "sparkle_feed.py check \"$stable/cua-spaces-appcast.xml\"" in nightly
+ assert "scripts/nightly-feeds.mjs" in nightly
+
+
+def test_nightly_is_gated_on_main_ci_and_on_changes():
+ nightly = source("nightly-cua-spaces.yml")
+ assert "spaces_nightly_gate.py" in nightly
+ assert "spaces_inputs_tree.sh HEAD" in nightly
+ assert "if: github.ref == 'refs/heads/main'" in nightly
+
+
+def test_nightly_builds_every_platform():
+ build = source("cd-cua-spaces-build.yml")
+ native = build.split("\n electron-native:\n", 1)[1].split("\n electron-windows-pkg:\n", 1)[0]
+ assert "inputs.channel != 'nightly'" not in native
+ assert "dist/nightly.yml" in build and "dist/nightly-linux*.yml" in build
+ assert build.count("needs.plan.outputs.electron_version") >= 3
+
+
+def test_release_workflow_refuses_betas_before_anything_else():
+ import yaml
+
+ release = yaml.safe_load(source("cd-cua-spaces.yml"))
+ jobs = release["jobs"]
+ guard = jobs["refuse-beta"]
+ assert "needs" not in guard
+ env = guard["steps"][0]["env"]
+ assert env["ALLOW_SPACES_BETA"] == "${{ vars.ALLOW_SPACES_BETA }}"
+ assert "*-beta*" in guard["steps"][0]["run"]
+
+ def deps(job, seen):
+ needs = jobs[job].get("needs", [])
+ for d in [needs] if isinstance(needs, str) else needs:
+ if d not in seen:
+ seen.add(d)
+ deps(d, seen)
+ return seen
+
+ # Every job waits for the guard: no build, staging smoke or draft before it.
+ assert [j for j in jobs if j != "refuse-beta" and "refuse-beta" not in deps(j, set())] == []
+ # A job that runs on !cancelled() still needs a real plan.
+ assert "needs.electron-plan.result == 'success'" in jobs["verify-release"]["if"]
diff --git a/.github/scripts/tests/test_sparkle_feed.py b/.github/scripts/tests/test_sparkle_feed.py
index f403eb705b..59756254e5 100644
--- a/.github/scripts/tests/test_sparkle_feed.py
+++ b/.github/scripts/tests/test_sparkle_feed.py
@@ -20,6 +20,16 @@ def feed(*items):
class SparkleFeed(unittest.TestCase):
+
+ def test_nightly_appcast_holds_only_nightlies(self):
+ ok = feed(("0.21.0-nightly.20261105+55e1f5d", "0.20.0.202611050731", "nightly"))
+ self.assertEqual(sf.nightly_violations(ok), [])
+ self.assertIsNone(sf.stable_version(ok))
+ stray = feed(("0.21.0-nightly.20261105+55e1f5d", "0.20.0.202611050731", "nightly"), ("0.20.0", "0.20.0.130", None))
+ self.assertEqual(sf.nightly_violations(stray), ["0.20.0 is not a nightly"])
+ untagged = feed(("0.21.0-nightly.20261105+55e1f5d", "0.20.0.202611050731", None))
+ self.assertTrue(sf.nightly_violations(untagged))
+
def test_beta_on_top_is_not_stable(self):
# The 3 Nov 2026 feed: 0.20.0-beta.1 (beta) is the first item.
f = feed(("0.20.0-beta.1", "0.20.0.129", "beta"), ("0.19.4", "0.19.4.128", None), ("0.19.3", "0.19.3.127", None))
diff --git a/.github/workflows/cd-cua-spaces-build.yml b/.github/workflows/cd-cua-spaces-build.yml
index 689e68a815..b7fadd25e3 100644
--- a/.github/workflows/cd-cua-spaces-build.yml
+++ b/.github/workflows/cd-cua-spaces-build.yml
@@ -35,11 +35,15 @@ name: "CD: Cua Spaces build (shadow)"
# (signer workflow: this file at refs/heads/main). verify-release.sh runs on
# the produced set before it is attested.
#
-# Nightly (CUA-1991; called by nightly-cua-spaces.yml with `channel:
-# nightly`): the same macOS build with the nightly version and
-# CFBundleVersion the caller chose, and nothing else. No Windows or Linux
-# build, no build set, attestation or marker: the caller publishes the
-# signed, notarized disk image to the nightly appcast and records the cost.
+# Nightly (CUA-1991, CUA-3503; called by nightly-cua-spaces.yml with
+# `channel: nightly`): the same macOS, Windows and Linux builds with the
+# nightly version and CFBundleVersion the caller chose. The Electron apps get
+# the version without its +sha build metadata (X.Y.Z-nightly.YYYYMMDD.N:
+# electron-builder takes no build metadata), which makes electron-builder
+# write the `nightly` feeds (nightly.yml, nightly-linux*.yml) for the
+# cua-spaces-nightly release. No build set, attestation or marker: the caller
+# publishes the signed parts (part-*, part-winfeed-*) to the nightly release
+# and records the cost.
on:
push:
@@ -65,7 +69,7 @@ on:
workflow_call:
inputs:
channel:
- description: "nightly: the macOS app only, for nightly-cua-spaces.yml"
+ description: "nightly: the nightly build for nightly-cua-spaces.yml"
type: string
required: true
version:
@@ -120,6 +124,8 @@ jobs:
skip: ${{ steps.plan.outputs.skip }}
reuse_run: ${{ steps.plan.outputs.reuse_run }}
version: ${{ steps.plan.outputs.version }}
+ # The Electron apps' version: the version without +build metadata.
+ electron_version: ${{ steps.plan.outputs.electron_version }}
build_number: ${{ github.run_number }}
tree: ${{ steps.plan.outputs.tree }}
retention: ${{ steps.plan.outputs.retention }}
@@ -170,6 +176,7 @@ jobs:
echo "skip=$skip"
echo "reuse_run=$reuse_run"
echo "version=$version"
+ echo "electron_version=${version%%+*}"
echo "tree=$TREE"
echo "retention=$retention"
} >> "$GITHUB_OUTPUT"
@@ -533,7 +540,6 @@ jobs:
electron-native:
name: Electron native (${{ matrix.label }})
needs: plan
- if: inputs.channel != 'nightly'
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
permissions:
@@ -585,7 +591,7 @@ jobs:
working-directory: apps/cua-spaces-desktop
shell: bash
env:
- VERSION: ${{ needs.plan.outputs.version }}
+ VERSION: ${{ needs.plan.outputs.electron_version }}
# Pack this architecture only (packaging/archs.cjs).
CUA_SPACES_ARCHS: ${{ matrix.arch }}
steps:
@@ -660,7 +666,7 @@ jobs:
- name: Build and sign (electron-builder)
env:
SIGNED: ${{ steps.signing.outputs.azure }}
- CUA_SPACES_VERSION: ${{ needs.plan.outputs.version }}
+ CUA_SPACES_VERSION: ${{ needs.plan.outputs.electron_version }}
CUA_SPACES_BUILD_NUMBER: ${{ github.run_number }}
ENDPOINT: ${{ vars.AZURE_ARTIFACT_SIGNING_ENDPOINT }}
ACCOUNT: ${{ vars.AZURE_ARTIFACT_SIGNING_ACCOUNT_NAME }}
@@ -691,7 +697,7 @@ jobs:
}
New-Item -ItemType Directory -Force electron-assets, electron-feed | Out-Null
Copy-Item dist/*.exe, dist/*.blockmap electron-assets/
- Copy-Item dist/beta.yml, dist/latest.yml electron-feed/ -ErrorAction SilentlyContinue
+ Copy-Item dist/beta.yml, dist/latest.yml, dist/nightly.yml electron-feed/ -ErrorAction SilentlyContinue
if ($env:ARCH -eq 'x64') {
if ($env:SIGNED -eq 'true') {
"electron-windows: Authenticode signed (Electron app, Azure Artifact Signing)" | Set-Content electron-assets/signing-electron-windows.txt
@@ -758,7 +764,7 @@ jobs:
# No OS code signing on Linux; electron-updater checks each file's sha512.
- name: Build (electron-builder)
env:
- CUA_SPACES_VERSION: ${{ needs.plan.outputs.version }}
+ CUA_SPACES_VERSION: ${{ needs.plan.outputs.electron_version }}
CUA_SPACES_BUILD_NUMBER: ${{ github.run_number }}
run: pnpm dist:linux
- name: Collect the assets
@@ -768,7 +774,7 @@ jobs:
set -euo pipefail
mkdir -p electron-assets
cp dist/*.AppImage dist/*.deb electron-assets/
- cp dist/beta-linux*.yml dist/latest-linux*.yml electron-assets/ 2>/dev/null || true
+ cp dist/beta-linux*.yml dist/latest-linux*.yml dist/nightly-linux*.yml electron-assets/ 2>/dev/null || true
if [ "$ARCH" = x64 ]; then
echo "electron-linux: updater sha512 only (no OS code signing on Linux)" > electron-assets/signing-electron-linux.txt
fi
@@ -788,6 +794,8 @@ jobs:
assemble:
name: Assemble the build set
needs: [plan, build-macos, electron-windows-pkg, electron-linux-pkg]
+ # A nightly is published part by part by nightly-cua-spaces.yml.
+ if: inputs.channel != 'nightly'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
diff --git a/.github/workflows/cd-cua-spaces.yml b/.github/workflows/cd-cua-spaces.yml
index 36a7893ea5..4c96e64a60 100644
--- a/.github/workflows/cd-cua-spaces.yml
+++ b/.github/workflows/cd-cua-spaces.yml
@@ -25,7 +25,10 @@ name: "CD: Cua Spaces"
# item is the notarized DMG of a release, EdDSA-signed by Sparkle's
# generate_appcast (apps/cua-spaces-macos/scripts/make-appcast.sh, checked
# by verify-appcast.sh). X.Y.Z-suffix versions go to the `beta` channel
-# (apps set to "Update to: Beta"). A beta is a production build with a
+# (apps set to "Update to: Beta"). Betas are retired (CUA-3503): the first
+# job refuses a -beta version unless the repository variable
+# ALLOW_SPACES_BETA is `true`; pre-release builds come from
+# nightly-cua-spaces.yml (the Nightly channel, its own release and feeds). A beta is a production build with a
# prerelease version, not a staging build: it is built exactly like a stable
# release, so it talks to production (CUA_ENV=staging at launch selects
# staging for any build). Only with the CUA_SPACES_SPARKLE_ED_PRIVATE_KEY
@@ -241,11 +244,41 @@ env:
REQUIRE_SIGNING: ${{ github.repository == 'trycua/cua' && startsWith(github.ref, 'refs/tags/') }}
jobs:
+ # No betas (CUA-3503): pre-release testing is the Nightly channel
+ # (nightly-cua-spaces.yml). A -beta version stops here, before anything is
+ # built, a staging smoke is asked for or a draft release exists, unless the
+ # repository variable ALLOW_SPACES_BETA is `true`
+ # (docs/contributing/releasing-cua-spaces.md). Every other job needs it.
+ refuse-beta:
+ name: Refuse beta versions
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions: {}
+ steps:
+ - name: Refuse beta versions
+ env:
+ REF_NAME: ${{ github.ref_name }}
+ INPUT_VERSION: ${{ inputs.version }}
+ ALLOW_SPACES_BETA: ${{ vars.ALLOW_SPACES_BETA }}
+ run: |
+ version="$INPUT_VERSION"
+ [ "$GITHUB_EVENT_NAME" = push ] && version="${REF_NAME#cua-spaces-v}"
+ case "$version" in
+ *-beta*)
+ if [ "$ALLOW_SPACES_BETA" = true ]; then
+ echo "::warning::$version is a beta; ALLOW_SPACES_BETA=true lets it through"
+ else
+ echo "::error::Cua Spaces has no betas any more: $version is refused. For pre-release testing use the Nightly channel (Settings, Advanced) or run the 'Nightly: Cua Spaces' workflow. Delete this tag: git push origin :refs/tags/cua-spaces-v$version"
+ exit 1
+ fi ;;
+ esac
+
# The bundled `cua` CLI bakes libs/cua-spacesd/VERSION and "Set up for
# access" downloads that release: refuse to build an app whose pinned
# cua-spacesd is not published (Cua Spaces 0.3.0 pinned a draft).
spacesd-published:
name: cua-spacesd pin is published
+ needs: refuse-beta
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
@@ -1088,6 +1121,7 @@ jobs:
# for every job that bundles it: the SwiftUI app, the Electron apps.
electron-web:
name: Web UI
+ needs: refuse-beta
runs-on: ubuntu-22.04
timeout-minutes: 60
defaults:
@@ -1920,6 +1954,7 @@ jobs:
# the gate times out and the smoke is started by hand as before.
request-staging-smoke:
name: Request the staging smoke
+ needs: refuse-beta
if: startsWith(github.ref, 'refs/tags/cua-spaces-v')
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -1954,6 +1989,7 @@ jobs:
# CUA_SPACES_PROMOTE_CHECK is "true". Never fails the run.
promote-check:
name: Promote check (report only)
+ needs: refuse-beta
if: startsWith(github.ref, 'refs/tags/cua-spaces-v') && vars.CUA_SPACES_PROMOTE_CHECK == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
@@ -2005,6 +2041,7 @@ jobs:
# tag publishes, so only a tag run is gated. Break-glass: skip_staging_gate.
staging-gate:
name: Staging smoke is green
+ needs: refuse-beta
if: startsWith(github.ref, 'refs/tags/cua-spaces-v')
runs-on: ubuntu-latest
# Waits up to 2 hours for the smoke that request-staging-smoke starts:
@@ -2034,7 +2071,7 @@ jobs:
# Each platform that is in this release must have built (build-macos is
# skipped, not failed, when a patch release has no macOS).
if: >-
- !cancelled()
+ !cancelled() && needs.electron-plan.result == 'success'
&& (needs.electron-plan.outputs.macos != 'true' || needs.build-macos.result == 'success')
&& (needs.electron-plan.outputs.windows != 'true' || needs.electron-windows.result == 'success')
&& (needs.electron-plan.outputs.build != 'true' || needs.electron-mac.result == 'success')
diff --git a/.github/workflows/nightly-cua-spaces.yml b/.github/workflows/nightly-cua-spaces.yml
index fc7faf1e5e..89bd43afb8 100644
--- a/.github/workflows/nightly-cua-spaces.yml
+++ b/.github/workflows/nightly-cua-spaces.yml
@@ -1,30 +1,59 @@
-name: "Nightly: Cua Spaces (macOS)"
+name: "Nightly: Cua Spaces"
-# The Nightly update channel of the Cua Spaces Mac app (CUA-1991, phase 1 of
-# the build-once plan in docs/design/desktop-release-build-once-promote.md,
-# trycua/cua#5704; channel switch: Settings, Advanced, Updates).
+# The Nightly update channel of Cua Spaces on macOS, Windows and Linux
+# (CUA-1991, CUA-3503; channel switch: Settings, Advanced, Updates). Nightly
+# replaces the old ad-hoc betas: there are no beta tags any more
+# (cd-cua-spaces.yml refuses them), and pre-release testing uses this
+# channel or a manual run of this workflow.
#
-# Every night, when the release inputs changed since the last nightly (the
-# input tree hash of .github/scripts/spaces_inputs_tree.sh, recorded in
-# nightly.json), builds main's macOS app with cd-cua-spaces-build.yml
-# (`channel: nightly`): signed, notarized and stapled like a release. Then
-# publishes the disk image to the rolling `cua-spaces-nightly` prerelease
-# (never "latest", tag never `cua-spaces-v*`, so no release workflow runs) and
-# adds it to that release's own Sparkle appcast,
-# cua-spaces-nightly-appcast.xml. Only apps set to Nightly read that feed, and
-# its items are on Sparkle's `nightly` channel, so nothing else installs them.
-# The stable and beta appcast on `cua-spaces-latest` is never touched.
+# Every night, when main's Spaces CI is green (.github/scripts/
+# spaces_nightly_gate.py: the ci-cua-spaces*.yml runs of main's head, or of
+# the newest commit that ran them) and the release inputs changed since the
+# last nightly (the input tree hash of .github/scripts/spaces_inputs_tree.sh,
+# recorded in nightly.json), builds main with cd-cua-spaces-build.yml
+# (`channel: nightly`): signed and notarized like a release (macOS Developer
+# ID, notarized and stapled; Windows Authenticode through Azure Artifact
+# Signing; Linux sha512 in the updater feed). Then publishes everything that
+# built to ONE rolling prerelease, `cua-spaces-nightly`: never "Latest", tag
+# never `cua-spaces-v*`, so no release workflow runs and no draft is ever
+# left behind. Each night replaces its assets.
#
-# Versions: VERSION X.Y.Z on main builds X.(Y+1).0-nightly.YYYYMMDD+<sha>
-# (a prerelease X.Y.Z-pre builds X.Y.Z-nightly...). CFBundleVersion, which
-# Sparkle compares, is X.Y.Z.<YYYYMMDDHHMM> (X.Y.Z.0.<...> for a prerelease):
-# above every build of the release it came from, below the next release, so
-# an app back on Stable takes the next stable release.
+# Feeds (all on `cua-spaces-nightly`; the stable and beta feeds on
+# `cua-spaces-latest` are never touched):
+# - macOS: cua-spaces-nightly-appcast.xml, Sparkle items on the `nightly`
+# channel (sparkle_feed.py nightly checks no stable item gets in). Only
+# apps set to Nightly read this feed.
+# - Windows: nightly.yml; Linux: nightly-linux.yml, nightly-linux-arm64.yml
+# (electron-updater channel `nightly`, apps/cua-spaces-desktop/scripts/
+# nightly-feeds.mjs refuses a latest*/beta* file, a non-nightly version
+# or an installer outside this release). Stable apps read latest*.yml on
+# `cua-spaces-latest` and never see these.
#
-# Cost: the last job writes the run's runner minutes per OS to the run
-# summary (the go/no-go of CUA-1991 is decided on them).
+# Downloads that keep their name every night (for docs and testers):
+# cua-spaces-nightly-darwin-universal.dmg, -windows-<arch>-setup.exe,
+# -linux-<arch>.AppImage and -linux-<arch>.deb on the same release.
#
-# workflow_dispatch builds even when nothing changed (`force`).
+# Versions: VERSION X.Y.Z on main builds
+# X.(Y+1).0-nightly.YYYYMMDD.<run number>+<sha7> (a prerelease X.Y.Z-pre
+# builds X.Y.Z-nightly...). The run number makes every nightly unique and
+# ordered, even two on one day (semver compares numeric identifiers as
+# numbers; an HHMM time would need a leading zero, which semver forbids).
+# The Electron apps carry it without the +<sha7> (electron-builder takes no
+# build metadata), and asset names join it with a dot (a GitHub asset name
+# has no '+').
+# CFBundleVersion, which Sparkle compares, is X.Y.Z.<YYYYMMDDHHMM>
+# (X.Y.Z.0.<...> for a prerelease): above every build of the release it came
+# from, below the next release, so an app back on Stable takes the next
+# stable release. electron-updater compares the semver version.
+#
+# A platform whose build failed keeps last night's build and feed; the others
+# still publish, and the run ends red. The input tree is recorded only when
+# every platform published, so the next night builds again.
+#
+# Cost: the last job writes the run's runner minutes per OS to the summary.
+#
+# workflow_dispatch: `force` builds even when nothing changed; `ignore_ci`
+# builds even when main's Spaces CI is red or still running.
on:
schedule:
@@ -36,6 +65,10 @@ on:
description: "Build even if nothing changed since the last nightly"
type: boolean
default: false
+ ignore_ci:
+ description: "Build even if main's Spaces CI is red or still running"
+ type: boolean
+ default: false
permissions:
contents: read
@@ -57,30 +90,47 @@ jobs:
name: Plan
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
- timeout-minutes: 10
+ # Includes up to 90 minutes waiting for main's Spaces CI to finish.
+ timeout-minutes: 100
permissions:
contents: read
+ actions: read
outputs:
skip: ${{ steps.plan.outputs.skip }}
version: ${{ steps.plan.outputs.version }}
+ electron_version: ${{ steps.plan.outputs.electron_version }}
bundle_version: ${{ steps.plan.outputs.bundle_version }}
tree: ${{ steps.plan.outputs.tree }}
previous_sha: ${{ steps.plan.outputs.previous_sha }}
+ previous_tree: ${{ steps.plan.outputs.previous_tree }}
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 100
+ filter: blob:none
- name: Plan
id: plan
env:
GH_TOKEN: ${{ github.token }}
FORCE: ${{ github.event_name == 'workflow_dispatch' && inputs.force }}
+ IGNORE_CI: ${{ github.event_name == 'workflow_dispatch' && inputs.ignore_ci }}
run: |
set -euo pipefail
tree="$(.github/scripts/spaces_inputs_tree.sh HEAD)"
last="$(gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern nightly.json --output - 2>/dev/null || echo '{}')"
last_tree="$(jq -r '.tree // ""' <<<"$last")"
previous_sha="$(jq -r '.sha // ""' <<<"$last")"
- skip=false
- if [ "$tree" = "$last_tree" ] && [ "$FORCE" != true ]; then skip=true; fi
+ skip=false; why=""
+ if [ "$tree" = "$last_tree" ] && [ "$FORCE" != true ]; then
+ skip=true; why="nothing changed since the last nightly"
+ fi
+ ci=skipped
+ if [ "$skip" = false ]; then
+ ci="$(python3 -I .github/scripts/spaces_nightly_gate.py "$GITHUB_REPOSITORY" "$GITHUB_SHA" --wait-minutes 90)"
+ if [ "$ci" != green ] && [ "$IGNORE_CI" != true ]; then
+ skip=true; why="main's Spaces CI is $ci at ${GITHUB_SHA:0:7}"
+ fi
+ fi
base="$(tr -d '[:space:]' < apps/cua-spaces-macos/VERSION)"
[[ "$base" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z.-]+)?$ ]] || { echo "::error::bad VERSION: $base"; exit 1; }
@@ -89,30 +139,35 @@ jobs:
day="${stamp:0:8}"
sha="${GITHUB_SHA:0:7}"
if [ -z "$pre" ]; then
- version="$x.$((y + 1)).0-nightly.$day+$sha"
+ electron_version="$x.$((y + 1)).0-nightly.$day.$GITHUB_RUN_NUMBER"
bundle_version="$x.$y.$z.$stamp"
else
- version="$x.$y.$z-nightly.$day+$sha"
+ electron_version="$x.$y.$z-nightly.$day.$GITHUB_RUN_NUMBER"
bundle_version="$x.$y.$z.0.$stamp"
fi
+ version="$electron_version+$sha"
{
echo "skip=$skip"
echo "version=$version"
+ echo "electron_version=$electron_version"
echo "bundle_version=$bundle_version"
echo "tree=$tree"
echo "previous_sha=$previous_sha"
+ echo "previous_tree=$last_tree"
} >> "$GITHUB_OUTPUT"
{
echo "## Plan"
echo "- Inputs tree \`$tree\` (last nightly: \`${last_tree:-none}\`)"
+ echo "- main's Spaces CI at ${GITHUB_SHA:0:7}: **$ci**"
if [ "$skip" = true ]; then
- echo "- **Skipped:** nothing changed since the last nightly."
+ echo "- **Skipped:** $why."
else
- echo "- Building **$version** (CFBundleVersion $bundle_version) from $GITHUB_SHA."
+ echo "- Building **$version** (Electron $electron_version, CFBundleVersion $bundle_version) from $GITHUB_SHA."
fi
} >> "$GITHUB_STEP_SUMMARY"
+ [ "$skip" = true ] && echo "::notice::Nightly skipped: $why" || true
- # The macOS app, signed and notarized: the release build, nightly version.
+ # Every platform, signed (and notarized on macOS): the release build, nightly version.
build:
name: Build
needs: plan
@@ -131,31 +186,88 @@ jobs:
bundle_version: ${{ needs.plan.outputs.bundle_version }}
secrets: inherit
- # The disk image to the rolling `cua-spaces-nightly` release and its item
- # into the nightly appcast (EdDSA-signed with the release key and checked
- # by verify-appcast.sh the way the app reads it).
+ # What built goes to the rolling `cua-spaces-nightly` release: installers
+ # first, then the feeds that point at them, then nightly.json.
publish:
- name: Publish to the nightly feed
+ name: Publish to the nightly channel
needs: [plan, build]
+ # A platform that failed must not hold back the others.
+ if: always() && needs.plan.result == 'success' && needs.plan.outputs.skip != 'true'
runs-on: macos-26
- timeout-minutes: 30
+ timeout-minutes: 45
# Holds the Sparkle EdDSA key; restricted to main.
environment: cua-driver-release-signing
permissions:
contents: write
env:
VERSION: ${{ needs.plan.outputs.version }}
+ ELECTRON_VERSION: ${{ needs.plan.outputs.electron_version }}
+ BASE_URL: https://github.com/${{ github.repository }}/releases/download/cua-spaces-nightly
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: blob:none
- - name: Download the signed disk image
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ - name: Download what built
uses: actions/download-artifact@v4
+ continue-on-error: true
with:
- name: part-darwin-universal
- path: ${{ runner.temp }}/part
+ pattern: part-*
+ path: ${{ runner.temp }}/parts
+ - name: What built
+ id: built
+ run: |
+ set -euo pipefail
+ parts="$RUNNER_TEMP/parts"
+ mkdir -p "$parts" out/installers out/feeds
+ macos=false; windows=false; linux=""
+ if [ -f "$parts/part-darwin-universal/cua-spaces-$VERSION-darwin-universal.dmg" ]; then
+ grep -q "Developer ID signed and notarized" "$parts/part-darwin-universal/signing-darwin-universal.txt" ||
+ { echo "::error::the nightly disk image is not signed and notarized"; exit 1; }
+ macos=true
+ fi
+ # Windows: both architectures or neither (one feed lists both installers).
+ if [ -f "$parts/part-winfeed-x64/nightly.yml" ] && [ -f "$parts/part-winfeed-arm64/nightly.yml" ]; then
+ windows=true
+ elif [ -d "$parts/part-winfeed-x64" ] || [ -d "$parts/part-winfeed-arm64" ]; then
+ echo "::warning::only one Windows architecture built: Windows keeps last night's build"
+ fi
+ for arch in x64 arm64; do
+ [ -n "$(ls "$parts/part-linux-$arch"/nightly-linux*.yml 2>/dev/null)" ] && linux="$linux $arch"
+ done
+ linux="${linux# }"
+ { echo "macos=$macos"; echo "windows=$windows"; echo "linux=$linux"; } >> "$GITHUB_OUTPUT"
+ echo "Built: macos=$macos windows=$windows linux=${linux:-none}"
+ [ "$macos" = true ] || [ "$windows" = true ] || [ -n "$linux" ] || { echo "::error::nothing built"; exit 1; }
+
+ # The installers, under their own names and under names that stay the same every night.
+ feeds=()
+ if [ "$windows" = true ]; then
+ for arch in x64 arm64; do
+ exe="$parts/part-windows-$arch/Cua-Spaces-Setup-$ELECTRON_VERSION-$arch.exe"
+ cp "$exe" "$exe.blockmap" out/installers/
+ cp "$exe" "out/installers/cua-spaces-nightly-windows-$arch-setup.exe"
+ feeds+=("$parts/part-winfeed-$arch")
+ done
+ fi
+ for arch in $linux; do
+ dir="$parts/part-linux-$arch"
+ file_arch="$([ "$arch" = x64 ] && echo x86_64 || echo arm64)"
+ deb_arch="$([ "$arch" = x64 ] && echo amd64 || echo arm64)"
+ cp "$dir/Cua-Spaces-$ELECTRON_VERSION-$file_arch.AppImage" "$dir/cua-spaces_${ELECTRON_VERSION}_$deb_arch.deb" out/installers/
+ cp "$dir/Cua-Spaces-$ELECTRON_VERSION-$file_arch.AppImage" "out/installers/cua-spaces-nightly-linux-$file_arch.AppImage"
+ cp "$dir/cua-spaces_${ELECTRON_VERSION}_$deb_arch.deb" "out/installers/cua-spaces-nightly-linux-$deb_arch.deb"
+ feeds+=("$dir")
+ done
+ if [ ${#feeds[@]} -gt 0 ]; then
+ node apps/cua-spaces-desktop/scripts/nightly-feeds.mjs --base "$BASE_URL" \
+ --version "$ELECTRON_VERSION" --out out/feeds "${feeds[@]}"
+ fi
- name: Sparkle appcast
+ if: steps.built.outputs.macos == 'true'
env:
GH_TOKEN: ${{ github.token }}
CUA_SPACES_SPARKLE_ED_PRIVATE_KEY: ${{ secrets.CUA_SPACES_SPARKLE_ED_PRIVATE_KEY }}
@@ -163,18 +275,15 @@ jobs:
run: |
set -euo pipefail
[ -n "$CUA_SPACES_SPARKLE_ED_PRIVATE_KEY" ] || { echo "::error::no CUA_SPACES_SPARKLE_ED_PRIVATE_KEY: cannot sign the nightly appcast"; exit 1; }
- grep -q "Developer ID signed and notarized" "$RUNNER_TEMP/part/signing-darwin-universal.txt" ||
- { echo "::error::the nightly disk image is not signed and notarized"; exit 1; }
# A GitHub asset name has no '+': the build metadata joins with a dot.
asset="cua-spaces-${VERSION//+/.}-darwin-universal.dmg"
- mkdir -p out
- mv "$RUNNER_TEMP/part/cua-spaces-$VERSION-darwin-universal.dmg" "out/$asset"
- echo "ASSET=$asset" >> "$GITHUB_ENV"
+ mv "$RUNNER_TEMP/parts/part-darwin-universal/cua-spaces-$VERSION-darwin-universal.dmg" "out/installers/$asset"
+ cp "out/installers/$asset" out/installers/cua-spaces-nightly-darwin-universal.dmg
# What changed since the last nightly (the release inputs only).
notes="$RUNNER_TEMP/notes.md"
{
- echo "Nightly build of main at ${GITHUB_SHA:0:7}. Nightly builds are not tested and may break; switch back to Stable in Settings, Advanced, Updates."
+ echo "Nightly build of main at ${GITHUB_SHA:0:7}. Nightly builds get the newest changes from main every day. They may break; switch back to Stable in Settings, Advanced."
echo
range="$GITHUB_SHA"
[ -n "$PREVIOUS_SHA" ] && git cat-file -e "$PREVIOUS_SHA^{commit}" 2>/dev/null && range="$PREVIOUS_SHA..$GITHUB_SHA"
@@ -186,51 +295,124 @@ jobs:
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "$APPCAST" \
--dir "$RUNNER_TEMP/previous" 2>/dev/null || true
apps/cua-spaces-macos/scripts/make-appcast.sh \
- --dmg "out/$asset" --version "$VERSION" \
- --download-base "https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/" \
+ --dmg "out/installers/$asset" --version "$VERSION" \
+ --download-base "$BASE_URL/" \
--previous "$RUNNER_TEMP/previous/$APPCAST" --notes "$notes" \
- --out "out/$APPCAST"
+ --out "out/feeds/$APPCAST"
+ python3 -I .github/scripts/sparkle_feed.py nightly "out/feeds/$APPCAST"
- name: Publish
env:
GH_TOKEN: ${{ github.token }}
TREE: ${{ needs.plan.outputs.tree }}
+ PREVIOUS_TREE: ${{ needs.plan.outputs.previous_tree }}
BUNDLE_VERSION: ${{ needs.plan.outputs.bundle_version }}
+ BUILD_RESULT: ${{ needs.build.result }}
+ MACOS: ${{ steps.built.outputs.macos }}
+ WINDOWS: ${{ steps.built.outputs.windows }}
+ LINUX: ${{ steps.built.outputs.linux }}
run: |
set -euo pipefail
- body="The newest Cua Spaces for Mac, built from main most nights. Nightly builds are not tested and may break. To get them, open Cua Spaces, Settings, Advanced, and set Updates to Nightly. Latest: $VERSION."
+ body="The newest Cua Spaces for Mac, Windows and Linux, built from main every night. Nightly builds get the newest changes from main every day. They may break. To get them, open Cua Spaces, Settings, Advanced, and choose Nightly. Latest: $VERSION."
if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \
--title "Cua Spaces Nightly" --notes "$body" --prerelease --latest=false
fi
- jq -n --arg version "$VERSION" --arg bundle "$BUNDLE_VERSION" --arg sha "$GITHUB_SHA" \
- --arg tree "$TREE" --arg asset "$ASSET" --arg run "$GITHUB_RUN_ID" \
- --arg at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
- '{version: $version, bundleVersion: $bundle, sha: $sha, tree: $tree, dmg: $asset, run: ($run | tonumber), builtAt: $at}' \
- > out/nightly.json
- # The image first, then the feed that points at it, then the record.
- gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber "out/$ASSET"
- gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber "out/$APPCAST"
- gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber out/nightly.json
+ # The installers first, then the feeds that point at them, then the record.
+ gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber out/installers/*
+ if [ -n "$(ls out/feeds)" ]; then
+ gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber out/feeds/*
+ fi
+
+ # nightly.json: what each platform has now. The input tree moves only
+ # when every platform published, so a failed one is built again tomorrow.
+ last="$(gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern nightly.json --output - 2>/dev/null || echo '{}')"
+ tree="$TREE"
+ [ "$BUILD_RESULT" = success ] || tree="$PREVIOUS_TREE"
+ at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
+ now="$(jq -n --arg version "$VERSION" --arg sha "$GITHUB_SHA" --arg at "$at" --arg run "$GITHUB_RUN_ID" \
+ '{version: $version, sha: $sha, builtAt: $at, run: ($run | tonumber)}')"
+ jq --arg version "$VERSION" --arg electron "$ELECTRON_VERSION" --arg bundle "$BUNDLE_VERSION" \
+ --arg sha "$GITHUB_SHA" --arg tree "$tree" --arg run "$GITHUB_RUN_ID" --arg at "$at" \
+ --argjson now "$now" --arg macos "$MACOS" --arg windows "$WINDOWS" --arg linux "$LINUX" \
+ '. as $last | {version: $version, electronVersion: $electron, bundleVersion: $bundle, sha: $sha,
+ tree: $tree, run: ($run | tonumber), builtAt: $at,
+ platforms: (($last.platforms // {})
+ + (if $macos == "true" then {macos: $now} else {} end)
+ + (if $windows == "true" then {windows: ($now + {version: $electron})} else {} end)
+ + (if ($linux | contains("x64")) then {"linux-x64": ($now + {version: $electron})} else {} end)
+ + (if ($linux | contains("arm64")) then {"linux-arm64": ($now + {version: $electron})} else {} end))}' \
+ <<<"$last" > nightly.json
+ cat nightly.json
+ gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber nightly.json
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes "$body" --prerelease --latest=false
- # Disk images the appcast no longer lists go.
- keep="$(python3 - "out/$APPCAST" <<'PY'
- import sys
+
+ # Installers no feed names any more go (the fixed-name downloads stay).
+ mkdir -p "$RUNNER_TEMP/live"
+ gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "*.yml" --pattern "$APPCAST" \
+ --dir "$RUNNER_TEMP/live" --clobber
+ keep="$(python3 -I - "$RUNNER_TEMP/live" <<'PY'
+ import os, re, sys, urllib.parse
import xml.etree.ElementTree as ET
- for e in ET.parse(sys.argv[1]).iter("enclosure"):
- print(e.get("url", "").rsplit("/", 1)[-1])
+ d = sys.argv[1]
+ for name in os.listdir(d):
+ p = os.path.join(d, name)
+ if name.endswith(".xml"):
+ urls = [e.get("url", "") for e in ET.parse(p).iter("enclosure")]
+ else:
+ urls = re.findall(r"^\s*(?:- )?(?:url|path):\s*['\"]?([^'\"\n]+?)['\"]?\s*$", open(p).read(), re.M)
+ for u in urls:
+ n = urllib.parse.unquote(u.rsplit("/", 1)[-1])
+ print(n)
+ print(n + ".blockmap")
PY
)"
gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' |
- grep '\.dmg$' | while read -r name; do
+ grep -E '\.(dmg|exe|blockmap|AppImage|deb)$' | grep -v '^cua-spaces-nightly-' | while read -r name; do
grep -qxF "$name" <<<"$keep" || gh release delete-asset "$TAG" "$name" --repo "$GITHUB_REPOSITORY" --yes
done
{
echo "## Published"
- echo "- **$VERSION** (CFBundleVersion $BUNDLE_VERSION)"
- echo "- Feed: https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/$APPCAST"
+ echo "- **$VERSION** (Electron $ELECTRON_VERSION, CFBundleVersion $BUNDLE_VERSION)"
+ echo "- macOS: $MACOS; Windows: $WINDOWS; Linux: ${LINUX:-none}"
+ echo "- Release: https://github.com/$GITHUB_REPOSITORY/releases/tag/$TAG"
} >> "$GITHUB_STEP_SUMMARY"
+ - name: Check the channel
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -euo pipefail
+ # Never Latest, always a prerelease.
+ latest="$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name 2>/dev/null || true)"
+ [ "$latest" != "$TAG" ] || { echo "::error::$TAG is the repository's Latest release"; exit 1; }
+ [ "$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isPrerelease --jq .isPrerelease)" = true ] ||
+ { echo "::error::$TAG is not a prerelease"; exit 1; }
+ # Every installer a nightly feed names, and every fixed-name download, resolves.
+ dir="$RUNNER_TEMP/check"; mkdir -p "$dir"
+ gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "*.yml" --pattern "$APPCAST" --dir "$dir" --clobber
+ [ ! -f "$dir/$APPCAST" ] || python3 -I .github/scripts/sparkle_feed.py nightly "$dir/$APPCAST"
+ urls="$( { grep -hoE 'https://[^"'"'"' ]+' "$dir"/*.yml 2>/dev/null || true; \
+ grep -hoE 'url="https://[^"]+"' "$dir"/*.xml 2>/dev/null | sed 's/^url="//; s/"$//' || true; } | sort -u)"
+ fixed="$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name | select(startswith("cua-spaces-nightly-"))')"
+ for name in $fixed; do urls="$urls"$'\n'"$BASE_URL/$name"; done
+ bad=0
+ while read -r url; do
+ [ -n "$url" ] || continue
+ code="$(curl -s -o /dev/null -w '%{http_code}' -L -r 0-0 "$url")"
+ if [ "$code" = 200 ] || [ "$code" = 206 ]; then echo "ok $url"; else echo "::error::$url answers $code"; bad=1; fi
+ done <<<"$urls"
+ # The stable feeds are not this workflow's: they hold no nightly.
+ stable="$RUNNER_TEMP/stable"; mkdir -p "$stable"
+ gh release download cua-spaces-latest --repo "$GITHUB_REPOSITORY" --pattern "latest*.yml" --pattern cua-spaces-appcast.xml --dir "$stable" 2>/dev/null || true
+ if grep -l -- '-nightly' "$stable"/latest*.yml 2>/dev/null; then echo "::error::a stable feed names a nightly"; bad=1; fi
+ [ ! -f "$stable/cua-spaces-appcast.xml" ] || python3 -I .github/scripts/sparkle_feed.py check "$stable/cua-spaces-appcast.xml" || bad=1
+ exit "$bad"
+ - name: A platform failed
+ if: needs.build.result != 'success'
+ run: |
+ echo "::error::the nightly build did not fully succeed (${{ needs.build.result }}); what built was published, the rest keeps last night's build"
+ exit 1
- # Runner minutes per OS for the CUA-1991 cost go/no-go.
+ # Runner minutes per OS.
cost:
name: Cost summary
needs: [plan, build, publish]
diff --git a/AGENTS.md b/AGENTS.md
index 4ab3c7377b..f2d56c1c85 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -175,6 +175,15 @@ heading (`## [x.y.z](...)`), never above it. Release Please reads the version
from that heading; with text above it, it tags every component with the PR's
version (#6350). `CI: Release metadata` and the release workflow both check this.
+## Cua Spaces: no betas
+
+Never tag a Cua Spaces beta (`cua-spaces-vX.Y.Z-beta.N`): the release workflow
+refuses it unless the repository variable `ALLOW_SPACES_BETA` is `true`. For
+pre-release testing, use the Nightly channel (Settings, Advanced, Nightly), or
+run the **Nightly: Cua Spaces** workflow (`nightly-cua-spaces.yml`) to build
+main now. Stable stays Release Please plus the canary gate. Details:
+[docs/contributing/releasing-cua-spaces.md](docs/contributing/releasing-cua-spaces.md).
+
## Monorepo component release resolution
Cua is a monorepo with independent component release streams. Never use
diff --git a/apps/cua-spaces-desktop/electron-builder.config.cjs b/apps/cua-spaces-desktop/electron-builder.config.cjs
index d3b61a24f7..a14e2cd032 100644
--- a/apps/cua-spaces-desktop/electron-builder.config.cjs
+++ b/apps/cua-spaces-desktop/electron-builder.config.cjs
@@ -46,7 +46,10 @@
// repository (<owner>/<repo>) updates from that repository. GitHub's own
// provider cannot serve this monorepo: it wants semver tags and reads the
// repository-wide latest release. An X.Y.Z-suffix version is channel `beta`
-// (beta*.yml), anything else `latest`.
+// (beta*.yml), anything else `latest`. A nightly (X.Y.Z-nightly.YYYYMMDD.N,
+// nightly-cua-spaces.yml) is channel `nightly` (nightly*.yml) on the rolling
+// `cua-spaces-nightly` prerelease instead, so its feed never sits beside the
+// stable one.
// The CI (cd-cua-spaces.yml) uploads the feed files with their URLs made
// absolute (scripts/feed-urls.mjs); scripts pass `--publish never`.
//
@@ -90,7 +93,9 @@ const buildVersion = `${semver[1]}.${semver[2]}.${semver[3]}.${buildNumber}`;
const repository = env.GITHUB_REPOSITORY || "trycua/cua";
if (!/^[\w.-]+\/[\w.-]+$/.test(repository)) throw new Error(`GITHUB_REPOSITORY must be owner/repo, got ${repository}`);
-const feedUrl = `https://github.com/${repository}/releases/download/cua-spaces-latest`;
+const nightly = /^nightly(\.|$)/.test(semver[4] || "");
+const feedUrl = `https://github.com/${repository}/releases/download/${nightly ? "cua-spaces-nightly" : "cua-spaces-latest"}`;
+const feedChannel = nightly ? "nightly" : prerelease ? "beta" : "latest";
// The Swift app's Info.plist strings this app must carry as well.
const swiftPlist = fs.readFileSync(path.join(__dirname, "../cua-spaces-macos/Support/Info.plist"), "utf8");
@@ -332,5 +337,5 @@ module.exports = {
},
// Feed for electron-updater (written to app-update.yml); see the header.
- publish: [{ provider: "generic", url: feedUrl, channel: prerelease ? "beta" : "latest" }],
+ publish: [{ provider: "generic", url: feedUrl, channel: feedChannel }],
};
diff --git a/apps/cua-spaces-desktop/scripts/nightly-feeds.mjs b/apps/cua-spaces-desktop/scripts/nightly-feeds.mjs
new file mode 100644
index 0000000000..74b9b31081
--- /dev/null
+++ b/apps/cua-spaces-desktop/scripts/nightly-feeds.mjs
@@ -0,0 +1,92 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The electron-updater feeds of a Windows and Linux nightly
+// (nightly-cua-spaces.yml). electron-builder writes nightly.yml (one per
+// Windows architecture), nightly-linux.yml and nightly-linux-arm64.yml for an
+// X.Y.Z-nightly.YYYYMMDD.N version (electron-builder.config.cjs). This joins the
+// Windows ones (merge-feeds.mjs), points every installer at the rolling
+// `cua-spaces-nightly` release (feed-urls.mjs), and refuses anything that
+// could reach a Stable app: a latest*.yml or beta*.yml, a version that is not
+// a nightly, or an installer URL outside the nightly release.
+//
+// node scripts/nightly-feeds.mjs --base https://github.com/OWNER/REPO/releases/download/cua-spaces-nightly \
+// --version 0.21.0-nightly.20261105.42 --out DIR PART_DIR...
+import { mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
+import * as path from "node:path";
+import { pathToFileURL } from "node:url";
+import { absolutize } from "./feed-urls.mjs";
+import { mergeFeeds } from "./merge-feeds.mjs";
+
+/** The feed files a nightly may publish (Windows, Linux x64, Linux arm64). */
+export const NIGHTLY_FEEDS = ["nightly.yml", "nightly-linux.yml", "nightly-linux-arm64.yml"];
+
+// X.Y.Z-nightly.YYYYMMDD.<run number>: unique and ordered (numeric identifiers, no leading zero).
+const NIGHTLY_VERSION = /^\d+\.\d+\.\d+-nightly\.\d{8}\.(?:0|[1-9]\d*)$/;
+
+/** Why `text`, the feed `name`, must not be published on the nightly release `base` (empty: it may). */
+export function nightlyFeedProblems(name, text, base, version) {
+ const problems = [];
+ if (!NIGHTLY_FEEDS.includes(name)) problems.push(`${name} is not a nightly feed file`);
+ const root = base.endsWith("/") ? base : `${base}/`;
+ if (!/\/releases\/download\/cua-spaces-nightly\/$/.test(root)) problems.push(`${base} is not the cua-spaces-nightly release`);
+ const v = /^version:\s*['"]?([^'"\n]+?)['"]?\s*$/m.exec(text)?.[1];
+ if (!v || !NIGHTLY_VERSION.test(v)) problems.push(`${name}: version ${v ?? "(none)"} is not X.Y.Z-nightly.YYYYMMDD.N`);
+ else if (version && v !== version) problems.push(`${name}: version ${v}, want ${version}`);
+ const urls = [...text.matchAll(/^\s*(?:- )?(?:url|path):\s*['"]?([^'"\n]+?)['"]?\s*$/gm)].map((m) => m[1]);
+ if (urls.length === 0) problems.push(`${name} names no installer`);
+ for (const url of urls) if (!url.startsWith(root)) problems.push(`${name}: ${url} is outside ${root}`);
+ return problems;
+}
+
+/** Every file under `dirs` (one level deep) by name: name -> [paths]. */
+function filesByName(dirs) {
+ const found = new Map();
+ for (const dir of dirs) {
+ for (const name of readdirSync(dir)) {
+ if (!found.has(name)) found.set(name, []);
+ found.get(name).push(path.join(dir, name));
+ }
+ }
+ return found;
+}
+
+/** Writes the publishable nightly feeds of `partDirs` into `out`; returns their names. */
+export function prepareNightlyFeeds({ base, version, out, partDirs }) {
+ const files = filesByName(partDirs);
+ const stray = [...files.keys()].filter((n) => /^(latest|beta)[\w-]*\.yml$/.test(n));
+ if (stray.length) throw new Error(`a nightly build wrote ${stray.join(", ")}: its channel is not nightly (electron-builder.config.cjs)`);
+ mkdirSync(out, { recursive: true });
+ const written = [];
+ for (const name of NIGHTLY_FEEDS) {
+ const sources = files.get(name) ?? [];
+ if (sources.length === 0) continue;
+ // Windows: one feed per architecture, joined; Linux: one per architecture already.
+ const text = absolutize(sources.length > 1 ? mergeFeeds(sources.map((f) => readFileSync(f, "utf8"))) : readFileSync(sources[0], "utf8"), base);
+ const problems = nightlyFeedProblems(name, text, base, version);
+ if (problems.length) throw new Error(problems.join("\n"));
+ writeFileSync(path.join(out, name), text);
+ written.push(name);
+ }
+ return written;
+}
+
+if (import.meta.url === pathToFileURL(process.argv[1]).href) {
+ const args = process.argv.slice(2);
+ const opt = (flag) => {
+ const i = args.indexOf(flag);
+ if (i < 0 || !args[i + 1]) {
+ console.error("usage: nightly-feeds.mjs --base URL --version V --out DIR PART_DIR...");
+ process.exit(2);
+ }
+ const value = args[i + 1];
+ args.splice(i, 2);
+ return value;
+ };
+ const base = opt("--base");
+ const version = opt("--version");
+ const out = opt("--out");
+ const written = prepareNightlyFeeds({ base, version, out, partDirs: args });
+ console.log(written.length ? written.join("\n") : "no nightly feed");
+}
diff --git a/apps/cua-spaces-desktop/test/nightly-feeds.test.ts b/apps/cua-spaces-desktop/test/nightly-feeds.test.ts
new file mode 100644
index 0000000000..b534c23547
--- /dev/null
+++ b/apps/cua-spaces-desktop/test/nightly-feeds.test.ts
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// The Windows and Linux nightly (CUA-3503): its own feed files on its own
+// release, so a Stable app (latest*.yml on cua-spaces-latest) never sees it.
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { createRequire } from "node:module";
+import { tmpdir } from "node:os";
+import * as path from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+// @ts-expect-error: plain .mjs script, no types
+import { NIGHTLY_FEEDS, nightlyFeedProblems, prepareNightlyFeeds } from "../scripts/nightly-feeds.mjs";
+
+const require = createRequire(import.meta.url);
+const configPath = require.resolve("../electron-builder.config.cjs");
+// The semver electron-updater compares versions with.
+const semver = require(require.resolve("semver", { paths: [path.dirname(require.resolve("electron-updater"))] }));
+
+function config(env: Record<string, string | undefined> = {}) {
+ const saved = { ...process.env };
+ for (const k of ["CUA_SPACES_VERSION", "CUA_SPACES_BUILD_NUMBER", "GITHUB_REPOSITORY"]) delete process.env[k];
+ Object.assign(process.env, env);
+ delete require.cache[configPath];
+ try {
+ return require(configPath);
+ } finally {
+ process.env = saved;
+ delete require.cache[configPath];
+ }
+}
+
+const VERSION = "0.21.0-nightly.20261105.42";
+const BASE = "https://github.com/trycua/cua/releases/download/cua-spaces-nightly";
+const STABLE_BASE = "https://github.com/trycua/cua/releases/download/cua-spaces-latest";
+
+const winFeed = (arch: string, version = VERSION) => `version: ${version}
+files:
+ - url: Cua-Spaces-Setup-${version}-${arch}.exe
+ sha512: ${arch}==
+ size: 100
+path: Cua-Spaces-Setup-${version}-${arch}.exe
+sha512: ${arch}==
+releaseDate: '2026-11-05T07:30:00.000Z'
+`;
+const linuxFeed = (file: string, version = VERSION) => `version: ${version}
+files:
+ - url: ${file}
+ sha512: lin==
+ size: 100
+path: ${file}
+sha512: lin==
+releaseDate: '2026-11-05T07:30:00.000Z'
+`;
+
+describe("electron-builder config: the nightly channel", () => {
+ it("a nightly version publishes nightly*.yml on the cua-spaces-nightly release", () => {
+ const c = config({ CUA_SPACES_VERSION: VERSION, CUA_SPACES_BUILD_NUMBER: "77" });
+ expect(c.extraMetadata.version).toBe(VERSION);
+ expect(c.publish).toEqual([{ provider: "generic", url: BASE, channel: "nightly" }]);
+ });
+
+ it("stable and beta keep the cua-spaces-latest feed and never the nightly channel", () => {
+ expect(config({ CUA_SPACES_VERSION: "0.21.0" }).publish).toEqual([{ provider: "generic", url: STABLE_BASE, channel: "latest" }]);
+ expect(config({ CUA_SPACES_VERSION: "0.21.0-beta.7" }).publish).toEqual([{ provider: "generic", url: STABLE_BASE, channel: "beta" }]);
+ // Only a suffix that starts with `nightly` is the nightly.
+ expect(config({ CUA_SPACES_VERSION: "0.21.0-nightlyish.1" }).publish[0].channel).toBe("beta");
+ });
+
+ it("refuses build metadata (electron-builder versions carry no +sha)", () => {
+ expect(() => config({ CUA_SPACES_VERSION: `${VERSION}+55e1f5d` })).toThrow(/CUA_SPACES_VERSION/);
+ });
+});
+
+describe("nightly-feeds", () => {
+ const dirs: string[] = [];
+ afterEach(() => {
+ for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });
+ });
+ function parts(files: Record<string, Record<string, string>>) {
+ const root = mkdtempSync(path.join(tmpdir(), "nightly-feeds-"));
+ dirs.push(root);
+ const partDirs = Object.entries(files).map(([dir, contents]) => {
+ const p = path.join(root, dir);
+ mkdirSync(p, { recursive: true });
+ for (const [name, text] of Object.entries(contents)) writeFileSync(path.join(p, name), text);
+ return p;
+ });
+ return { root, partDirs, out: path.join(root, "out") };
+ }
+
+ it("joins the Windows feeds and points every installer at the nightly release", () => {
+ const { partDirs, out } = parts({
+ "part-winfeed-x64": { "nightly.yml": winFeed("x64") },
+ "part-winfeed-arm64": { "nightly.yml": winFeed("arm64") },
+ "part-linux-x64": { "nightly-linux.yml": linuxFeed(`Cua-Spaces-${VERSION}-x86_64.AppImage`), "x.AppImage": "" },
+ "part-linux-arm64": { "nightly-linux-arm64.yml": linuxFeed(`Cua-Spaces-${VERSION}-arm64.AppImage`) },
+ });
+ expect(prepareNightlyFeeds({ base: BASE, version: VERSION, out, partDirs })).toEqual(NIGHTLY_FEEDS);
+ const win = readFileSync(path.join(out, "nightly.yml"), "utf8");
+ expect(win).toContain(` - url: ${BASE}/Cua-Spaces-Setup-${VERSION}-x64.exe\n`);
+ expect(win).toContain(` - url: ${BASE}/Cua-Spaces-Setup-${VERSION}-arm64.exe\n`);
+ expect(readFileSync(path.join(out, "nightly-linux-arm64.yml"), "utf8")).toContain(`path: ${BASE}/Cua-Spaces-${VERSION}-arm64.AppImage\n`);
+ });
+
+ it("publishes what built: a platform that failed has no feed", () => {
+ const { partDirs, out } = parts({ "part-linux-x64": { "nightly-linux.yml": linuxFeed("a.AppImage") } });
+ expect(prepareNightlyFeeds({ base: BASE, version: VERSION, out, partDirs })).toEqual(["nightly-linux.yml"]);
+ });
+
+ it("refuses a stable or beta feed in a nightly build", () => {
+ const { partDirs, out } = parts({ "part-winfeed-x64": { "latest.yml": winFeed("x64", "0.21.0") } });
+ expect(() => prepareNightlyFeeds({ base: BASE, version: VERSION, out, partDirs })).toThrow(/latest\.yml/);
+ const beta = parts({ "part-linux-x64": { "beta-linux.yml": linuxFeed("a.AppImage", "0.21.0-beta.1") } });
+ expect(() => prepareNightlyFeeds({ base: BASE, version: VERSION, out: beta.out, partDirs: beta.partDirs })).toThrow(/beta-linux\.yml/);
+ });
+
+ it("refuses a feed that is not a nightly, or that would land on the stable release", () => {
+ const abs = (text: string, base = BASE) => text.replace(/(url|path): (\S+)/g, `$1: ${base}/$2`);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64")), BASE, VERSION)).toEqual([]);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64", "0.21.0")), BASE, undefined).join()).toMatch(/not X\.Y\.Z-nightly/);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64", "0.21.0-beta.7")), BASE, undefined).join()).toMatch(/not X\.Y\.Z-nightly/);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64"), STABLE_BASE), BASE, VERSION).join()).toMatch(/outside/);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64"), STABLE_BASE), STABLE_BASE, VERSION).join()).toMatch(/not the cua-spaces-nightly release/);
+ expect(nightlyFeedProblems("latest.yml", abs(winFeed("x64")), BASE, VERSION).join()).toMatch(/not a nightly feed/);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64", "0.21.0-nightly.20261105.41")), BASE, VERSION).join()).toMatch(/want/);
+ });
+
+ it("every nightly is newer than the one before, even two on one day, and below the next stable", () => {
+ // nightly-cua-spaces.yml: X.Y.Z-nightly.YYYYMMDD.<run number> (Electron), +sha7 on the Mac.
+ const order = ["0.20.0", "0.21.0-nightly.20261105.42", "0.21.0-nightly.20261105.43", "0.21.0-nightly.20261106.44", "0.21.0"];
+ for (let i = 1; i < order.length; i++) expect(semver.gt(order[i], order[i - 1])).toBe(true);
+ // Run numbers compare as numbers (9 < 10), not as text.
+ expect(semver.gt("0.21.0-nightly.20261105.10", "0.21.0-nightly.20261105.9")).toBe(true);
+ // An HHMM time would need a leading zero, which semver (and this check) refuses.
+ expect(semver.valid("0.21.0-nightly.20261105.0731")).toBeNull();
+ const abs = (text: string) => text.replace(/(url|path): (\S+)/g, `$1: ${BASE}/$2`);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64", "0.21.0-nightly.20261105.0731")), BASE, undefined).join()).toMatch(/not X\.Y\.Z-nightly/);
+ expect(nightlyFeedProblems("nightly.yml", abs(winFeed("x64", "0.21.0-nightly.20261105")), BASE, undefined).join()).toMatch(/not X\.Y\.Z-nightly/);
+ });
+});
diff --git a/apps/cua-spaces-macos/README.md b/apps/cua-spaces-macos/README.md
index 32d41412b5..715b250610 100644
--- a/apps/cua-spaces-macos/README.md
+++ b/apps/cua-spaces-macos/README.md
@@ -549,6 +549,10 @@ only if either failed.
### Release versions
+There are no betas: pre-release builds are the Nightly channel
+(`nightly-cua-spaces.yml`, its own `cua-spaces-nightly` release and feeds;
+see [docs/contributing/releasing-cua-spaces.md](../../docs/contributing/releasing-cua-spaces.md)).
+
Release Please drives the `cua-spaces` component from this directory: a
releasable conventional commit (`fix:`, `feat:`) that touches
`apps/cua-spaces-macos` opens the `cua-spaces` release PR, which bumps
diff --git a/docs/contributing/releasing-cua-spaces.md b/docs/contributing/releasing-cua-spaces.md
new file mode 100644
index 0000000000..c392df0358
--- /dev/null
+++ b/docs/contributing/releasing-cua-spaces.md
@@ -0,0 +1,59 @@
+# Releasing Cua Spaces: Stable and Nightly
+
+Cua Spaces has two update channels. There are no betas.
+
+| Channel | Who gets it | Where it comes from |
+| --- | --- | --- |
+| Stable (default) | Everyone | Release Please opens the `cua-spaces` release PR; merging it tags `cua-spaces-vX.Y.Z` and `cd-cua-spaces.yml` builds, verifies (staging smoke and canary gate) and publishes the release and the stable feeds on `cua-spaces-latest`. |
+| Nightly | Apps set to Nightly in Settings, Advanced | `nightly-cua-spaces.yml` builds main every night and replaces the assets of one rolling prerelease, `cua-spaces-nightly`. |
+
+## Testing before a release
+
+Don't tag a beta. To test what is on main:
+
+- install or switch to the Nightly channel (Settings, Advanced, Nightly), or
+ download a nightly directly from the
+ [`cua-spaces-nightly` release](https://github.com/trycua/cua/releases/tag/cua-spaces-nightly)
+ (the `cua-spaces-nightly-*` files keep their names every night); or
+- run the **Nightly: Cua Spaces** workflow by hand (Actions, Run workflow) to
+ build main now. `force` builds even when nothing changed; `ignore_ci`
+ builds even when main's Spaces CI is red or still running.
+
+## How the nightly works
+
+- **When:** every day at 07:30 UTC, and on a manual run. It skips when the
+ release inputs haven't changed since the last nightly, or when main's
+ Spaces CI (`ci-cua-spaces*.yml`) is red, or still running after 90 minutes.
+- **What:** the same signed builds as a release: macOS notarized and
+ stapled, Windows Authenticode signed, Linux AppImage and deb.
+- **Version:** `X.Y.Z-nightly.YYYYMMDD.N+sha7`, where X.Y.Z is the next
+ minor after main's version and N is the workflow's run number, so every
+ nightly is unique and newer than the one before, even two on one day. The
+ Windows and Linux apps carry it without `+sha7`.
+- **Feeds:** all on `cua-spaces-nightly`, never on `cua-spaces-latest`.
+ - macOS: `cua-spaces-nightly-appcast.xml`, every item on Sparkle's
+ `nightly` channel.
+ - Windows: `nightly.yml`.
+ - Linux: `nightly-linux.yml` and `nightly-linux-arm64.yml`.
+ - Stable apps read `cua-spaces-appcast.xml` and `latest*.yml` on
+ `cua-spaces-latest`, so they never see a nightly. Each run checks this
+ after it publishes, and checks that every download link resolves.
+- **Never Latest:** the release is a prerelease created with
+ `--latest=false`, and its tag never matches `cua-spaces-v*`, so no release
+ workflow runs and no draft is left behind.
+- **Failures:** a platform that fails keeps last night's build, the other
+ platforms still publish, and the run ends red.
+
+Cua Driver and Lume use immutable per-night tags
+([RFC 3096](../rfcs/3096-immutable-nightly-release-channels.md)). Spaces uses
+one rolling release on purpose: the in-app updaters read a fixed feed URL,
+and 29 beta tags in a month showed that per-build releases pile up.
+
+## The beta guard
+
+`cd-cua-spaces.yml` refuses any `-beta` version (tag push or manual run) in
+its first job, before anything is built or a draft release is created. To
+allow one in an emergency, set the repository variable `ALLOW_SPACES_BETA` to
+`true` (Settings, Secrets and variables, Actions, Variables), then delete it
+right after. Betas published before November 2026 remain as prereleases;
+their items in the beta feeds are no longer updated.