Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Betas: release.sh X.Y.Z-beta.N, pre-releases, Preview update channel
islandmedd1f7838243b9
diff --git a/.github/workflows/discord-announce.yml b/.github/workflows/discord-announce.ymlindex 1754ee7e..40f94ae6 100644--- a/.github/workflows/discord-announce.yml+++ b/.github/workflows/discord-announce.yml@@ -5,6 +5,8 @@# - A release: "SculptForge vX.Y.Z is out", the release's feed highlights, the download link and the release URL.# The Release workflow publishes with GITHUB_TOKEN, and GitHub sends no `release` event for that, so its# successful run (workflow_run) triggers the post; `release: published` covers a release published by hand.+# - A beta (a vX.Y.Z-beta.N or -rc.N pre-release): "SculptForge X.Y.Z Beta N is out for testing", the highlights of+# the feed's channels.preview (release.sh step "preview"), the release link and how to send feedback (#bug-reports).# release.sh step "site" writes the highlights to website/latest.json on main after the release is out, so the# job waits (up to FEED_WAIT_MINUTES) for the feed to name this version, then posts without highlights if it never does.# - Run workflow: posts .github/announcements/<file> (at most 2000 characters), with an optional embed image: a@@ -108,10 +110,11 @@ jobs:if not started or not new:print("This Release run published no new release; nothing to post."); sys.exit(0)tag, url, pre = new[0]["tag_name"], new[0]["html_url"], new[0]["prerelease"]- m = re.fullmatch(r"v(\d+\.\d+\.\d+)", tag)- if pre or not m:- print(f"{tag} is a prerelease or not vX.Y.Z; nothing to post."); sys.exit(0)- version, highlights = m[1], []+ m = re.fullmatch(r"v(\d+\.\d+\.\d+)(?:-(beta|rc)\.(\d+))?", tag)+ if not m or pre != bool(m[2]):+ print(f"{tag} is not vX.Y.Z, or a pre-release that is not vX.Y.Z-beta.N/-rc.N; nothing to post."); sys.exit(0)+ version, highlights = tag[1:], []+ label = f"{m[1]} {'Beta' if m[2] == 'beta' else 'RC'} {m[3]}" if pre else f"v{version}"deadline = time.time() + 60 * float(env("FEED_WAIT_MINUTES", "45"))while True:subprocess.run(["git", "fetch", "-q", "--depth=1", "origin", env("BRANCH", "main")], check=True)@@ -121,6 +124,8 @@ jobs:feed = json.loads(shown.stdout)except ValueError:feed = {}+ if pre: # a beta's highlights are in the Preview channel's entry+ feed = (feed.get("channels") or {}).get("preview") or {} if isinstance(feed, dict) else {}if feed.get("version") == version:highlights = [h.strip() for h in feed.get("highlights", []) if isinstance(h, str) and h.strip()][:6]break@@ -128,10 +133,23 @@ jobs:print(f"::warning::website/latest.json never said {version}; posting without highlights"); breaktime.sleep(60)while True:- lines = [f"**SculptForge v{version} is out**"] + [f"• {h}" for h in highlights]+ if pre:+ lines = [f"**SculptForge {label} is out for testing**",+ "A beta of the next release: please try it on your own work before it goes stable."]+ else:+ lines = [f"**SculptForge {label} is out**"]+ lines += [f"• {h}" for h in highlights]if not highlights:lines.append(f"What's new: {SITE}/guide/whats-new.html")- text = "\n".join(lines + [f"Download: {SITE}", f"Release notes: {url}"])+ if pre:+ tail = [f"Download the beta (Windows, macOS, Linux): {url}",+ "Feedback: post in #bug-reports with your OS, the version (Help > About) and your "+ "hardware (graphics card, tablet), plus what you did and what you saw. What works well "+ "is welcome too.",+ "Want the next betas offered in the app? Preferences > Updates > Update channel: Preview."]+ else:+ tail = [f"Download: {SITE}", f"Release notes: {url}"]+ text = "\n".join(lines + tail)if len(text) <= 2000 or not highlights:breakhighlights.pop()diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.ymlindex 62eb6aa3..6d25197e 100644--- a/.github/workflows/packages.yml+++ b/.github/workflows/packages.yml@@ -65,7 +65,8 @@ jobs:- uses: actions/checkout@v7with: { ref: '${{ env.REF }}' }- name: Tag (the release's, or v<project version>)- run: echo "TAG=${{ inputs.tag }}" | sed "s/^TAG=$/TAG=v$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)/" >> "$GITHUB_ENV"+ # (a beta's tag names its packages without the prerelease: v0.11.0-beta.1 makes SculptForge-0.11.0-*)+ run: echo "TAG=${{ inputs.tag }}" | sed "s/^TAG=$/TAG=v$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)/; s/^\(TAG=v[0-9.]*\)-.*/\1/" >> "$GITHUB_ENV"- run: |sudo ./packaging/linux/install-build-deps.shsudo apt-get install -y --no-install-recommends ccache xvfb libgl1-mesa-dri@@ -168,7 +169,8 @@ jobs:- uses: actions/checkout@v7with: { ref: '${{ env.REF }}' }- name: Tag (the release's, or v<project version>)- run: echo "TAG=${{ inputs.tag }}" | sed "s/^TAG=$/TAG=v$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)/" >> "$GITHUB_ENV"+ # (a beta's tag names its packages without the prerelease: v0.11.0-beta.1 makes SculptForge-0.11.0-*)+ run: echo "TAG=${{ inputs.tag }}" | sed "s/^TAG=$/TAG=v$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)/; s/^\(TAG=v[0-9.]*\)-.*/\1/" >> "$GITHUB_ENV"- run: ./packaging/linux/install-build-deps.sh- name: ccache (the static release binary, pinned by hash)run: |diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex a8bb709e..d7203ef9 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -2,13 +2,15 @@ name: Release# A v* tag publishes a GitHub release (docs/releasing.md has the whole process; scripts/release.sh drives it).#-# locate the tagged commit must carry the version the tag names (CMakeLists.txt). If CI and the Packages+# locate the tagged commit must carry the version the tag names (CMakeLists.txt's version, plus its+# SCULPTFORGE_PRERELEASE for a beta: v0.11.0-beta.1 tags 0.11.0 with "beta.1"). If CI and the Packages# workflow (packages.yml) both succeeded on a push to main for exactly this commit, the release uses those# packages: built and tested once, promoted unchanged. Otherwise:# build the Packages workflow runs here, from the tag (compiler cache restored from main, never saved).# smoke every package installed or unpacked on a fresh runner: the app opens a model and sculpts# (tests/ui/release_smoke.sfui), sculptforge-cli opens, sculpts, saves and reopens (tests/release_smoke.py).-# publish only after every smoke test passed: checksums, notes from CHANGELOG.md, the GitHub release.+# publish only after every smoke test passed: checksums, notes from CHANGELOG.md, the GitHub release. A tag with+# a '-' (a beta) is published as a pre-release, never marked latest, with CHANGELOG's [Unreleased] notes.## Only publish holds a token that can write (contents: write); every other job reads. Build and smoke jobs take their# runner from the SF_RUNNER_* repository variables (standard GitHub runners when unset); locate and publish always run@@ -62,12 +64,13 @@ jobs:sha=$(git rev-parse HEAD)echo "sha=$sha" >> "$GITHUB_OUTPUT"version=$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)- if [ "$DRY_RUN" = true ] && ! git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then+ pre=$(sed -n 's/^set(SCULPTFORGE_PRERELEASE "\([^"]*\)")$/\1/p' CMakeLists.txt)+ version=$version${pre:+-$pre} # a beta: 0.11.0-beta.1 if [ "$DRY_RUN" = true ] && ! git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then# A dry run of a branch or commit: its packages are named for the version it carries.echo "Dry run of $TAG ($sha), packages named v$version"echo "tag=v$version" >> "$GITHUB_OUTPUT"elif [ "v$version" != "$TAG" ]; then- echo "::error::$TAG tags a commit whose CMakeLists.txt says $version. Fix: delete the tag, bump the version (or tag v$version), tag again."+ echo "::error::$TAG tags a commit whose CMakeLists.txt says $version (version and SCULPTFORGE_PRERELEASE). Fix: delete the tag, bump the version (scripts/release.sh, or tag v$version), tag again."exit 1elseecho "tag=$TAG" >> "$GITHUB_OUTPUT"@@ -227,6 +230,7 @@ jobs:run: |cd distV=${TAG#v}+ V=${V%%-*} # a beta's packages carry its version without the prerelease (the app shows it)cp "SculptForge-$V-windows-x86_64.exe" SculptForge-windows-x86_64-setup.execp "SculptForge-$V-windows-x86_64.zip" SculptForge-windows-x86_64-portable.zipcp "SculptForge-$V-darwin-universal.dmg" SculptForge-macos.dmg@@ -240,8 +244,10 @@ jobs:cp "SculptForge-$V-aarch64.flatpak" SculptForge-linux-arm64.flatpak- name: Blender add-on (extension and legacy zips, plus a version-less copy for the website's link)run: |- python3 addons/blender/build_addon.py --check --version "${TAG#v}" --out dist- cp "dist/sculptforge_bridge-${TAG#v}.zip" dist/sculptforge_bridge.zip+ V=${TAG#v}+ V=${V%%-*}+ python3 addons/blender/build_addon.py --check --version "$V" --out dist+ cp "dist/sculptforge_bridge-$V.zip" dist/sculptforge_bridge.zip- name: Maya shelf script (Python source and its README; nothing to build)run: python3 -m zipfile -c dist/sculptforge_maya.zip integrations/maya/sculptforge_maya.py integrations/maya/README.md- name: ZBrush ZTL Export plug-in (ZScript source; ZBrush compiles it)@@ -250,11 +256,23 @@ jobs:run: cd dist && sha256sum * > SHA256SUMS.txt && cat SHA256SUMS.txt- name: Release notes from CHANGELOGrun: |- awk "/^## \[${TAG#v}\]/{flag=1;next} /^## \[/{flag=0} flag" CHANGELOG.md > notes.md+ section=${TAG#v}+ if [[ "$TAG" == *-* ]]; then # a beta: what has changed since the stable release+ section=Unreleased+ printf '%s\n\n' "**Beta for testers.** Please report problems in the Discord's #bug-reports (or a GitHub issue) with your OS, this version (Help > About) and your graphics card. Preferences > Updates > Update channel: Preview offers the next betas." > notes.md+ fi+ awk -v h="## [$section]" 'index($0, h) == 1 {flag=1;next} /^## \[/{flag=0} flag' CHANGELOG.md >> notes.mdcat packaging/release-notes-footer.md >> notes.md- name: Create or update the releaseenv:GH_TOKEN: ${{ github.token }}run: |- gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "SculptForge ${TAG#v}" --notes-file notes.md+ if [[ "$TAG" == *-* ]]; then # v0.11.0-beta.1: "SculptForge 0.11.0 Beta 1", a pre-release, not latest+ pre=${TAG#*-}+ title="SculptForge ${TAG%%-*} $(sed -E 's/^rc/RC/; s/^./\U&/; s/\./ /g' <<<"$pre")"+ gh release view "$TAG" >/dev/null 2>&1 ||+ gh release create "$TAG" --title "${title/SculptForge v/SculptForge }" --notes-file notes.md --prerelease --latest=false+ else+ gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "SculptForge ${TAG#v}" --notes-file notes.md+ figh release upload "$TAG" dist/* --clobberdiff --git a/CMakeLists.txt b/CMakeLists.txtindex 445bd309..e2d06cc0 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1,5 +1,8 @@cmake_minimum_required(VERSION 3.24)project(SculptForge VERSION 0.10.10 LANGUAGES C CXX)+# "beta.1" while this is a beta of that version (title bar and About: "0.11.0 Beta 1"), "" for a stable release.+# scripts/release.sh sets it; release.yml checks the tag against both (v0.11.0-beta.1).+set(SCULPTFORGE_PRERELEASE "")include(GNUInstallDirs)set(CMAKE_CXX_STANDARD 20)@@ -386,6 +389,7 @@ if(SCULPTFORGE_BUILD_APP)target_link_libraries(sculptforge PRIVATE sculptforge_core sculptforge_ai sculptforge_phone imgui SDL3::SDL3)target_include_directories(sculptforge PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lucide)target_compile_definitions(sculptforge PRIVATE SCULPTFORGE_VERSION="${PROJECT_VERSION}"+ SCULPTFORGE_PRERELEASE="${SCULPTFORGE_PRERELEASE}"SF_UPDATE_CHECK=$<BOOL:${SCULPTFORGE_UPDATE_CHECK}>)# The commit a build came from, for proof mode's results (src/app/ProofMode.cpp); taken when CMake configures.find_package(Git QUIET)@@ -665,6 +669,11 @@ if(SCULPTFORGE_BUILD_TESTS)# every fragment on this branch parses.add_test(NAME release_notes COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/assemble_notes.py --self-test)add_test(NAME release_notes_fragments COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/assemble_notes.py --check)+ # scripts/release.sh's beta (X.Y.Z-beta.N) and its promotion to stable, in a sandbox with stand-ins for gh and curl.+ if(UNIX AND NOT APPLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)+ add_test(NAME release_script_beta COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/tests/release_beta_test.sh)+ set_tests_properties(release_script_beta PROPERTIES TIMEOUT 300)+ endif()# The Actions cache pruner keeps the newest cache of each kind (tools/ci/prune_caches.py).add_test(NAME ci_prune_caches COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/ci/prune_caches.py --self-test)add_test(NAME ci_slowest_tests COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/ci/slowest_tests.py --self-test)diff --git a/changes/feat-preview-cut.md b/changes/feat-preview-cut.mdnew file mode 100644index 00000000..18f2db7f--- /dev/null+++ b/changes/feat-preview-cut.md@@ -0,0 +1,10 @@+---+whats_new: **Update channel**: **Preferences > Updates > Update channel** picks **Stable** (finished releases, the default) or **Preview (betas)**, which also offers the betas of the next version, a couple of weeks before it ships. A beta says so in the title bar and About ("0.11.0 Beta 1"). Problems in a beta go to the Discord's #bug-reports.+added: **Update channel** (Preferences > Updates): Stable or Preview. Preview is also offered the betas, which the update feed lists under `channels.preview`. It is never offered anything older than the stable release. Betas are GitHub pre-releases (`vX.Y.Z-beta.N`). They show "X.Y.Z Beta N" in the title bar and About.+changed: Version comparison in the update check: a prerelease sorts before its version (0.11.0-beta.1 < 0.11.0), and betas compare by number.+testers:+ - Any OS: Preferences > Updates shows Update channel: Stable selected; switch to Preview, restart, it is still Preview.+ - Any OS: on Preview, Help > Check for updates still says this version is the newest (no beta is out yet).+---+Release tooling for betas: scripts/release.sh X.Y.Z-beta.N, release.yml pre-releases, discord-announce.yml beta posts,+docs/releasing.md "Betas". The first beta is 0.11.0-beta.1, cut after stable 0.10.11.diff --git a/docs/releasing.md b/docs/releasing.mdindex 477a2b43..82e697d4 100644--- a/docs/releasing.md+++ b/docs/releasing.md@@ -86,6 +86,42 @@ tagging.Scripting rule: under `set -o pipefail`, never end a pipe with `grep -q` or `head` (they close the pipe early and thewriter fails); capture to a variable or file first, or let grep read everything (`grep ... >/dev/null`).+## Betas (the Preview channel)++A beta is the next release, published early for testers (docs/design/release-train.md §1). The first one is 0.11.0+Beta 1, cut after stable 0.10.11 ships.++```sh+HIGHLIGHTS=highlights.txt scripts/release.sh 0.11.0-beta.1 --yes # a beta (also 0.11.0-rc.1)+HIGHLIGHTS=highlights.txt scripts/release.sh 0.11.0 --yes # later: the stable release, on main as it is then+```++Steps for a beta: `bump check ci tag release preview status`.++- **bump** writes the note fragments into CHANGELOG `[Unreleased]` and What's New `0.11.0` (date stays `unreleased`), and+ saves their testers bullets to `release-testers-0.11.0-beta.1.md` first. It sets CMakeLists.txt to+ `VERSION 0.11.0` and `set(SCULPTFORGE_PRERELEASE "beta.1")`. The app reads "0.11.0 Beta 1" in the title bar and+ About; packages are named `SculptForge-0.11.0-*`. CITATION, rez, metainfo, the CHANGELOG section and the home page+ stay at the stable release (`build_site.py` leaves the home page alone while a prerelease is set).+- **check** checks CMakeLists.txt (version and prerelease), the guide and the DPI tests. A beta skips the+ site/AUR/Homebrew/Omarchy checks.+- **tag / release**: `v0.11.0-beta.1`. release.yml checks that the tag equals the version plus the prerelease. It+ publishes a GitHub **pre-release**, never marked latest, so `releases/latest/download/...` and the site stay on+ stable. The notes are CHANGELOG `[Unreleased]` with a line on how to send feedback.+- **preview** writes `channels.preview` (version, the release's link, the highlights) into website/latest.json. The+ stable top level is unchanged, so old apps and the Stable channel see nothing new. Apps whose+ Preferences > Updates > Update channel is **Preview** are offered the beta (a beta build starts on Preview).+- **Discord**: discord-announce.yml posts "SculptForge 0.11.0 Beta 1 is out for testing" in #announcements once the+ feed names it. The post has the highlights, the download link and how to send feedback (#bug-reports, with OS,+ version and hardware).+- **status** prints the release link, the testers checklist (post it in #testers) and the promote command.+- No site, AUR, Homebrew, Omarchy, winget or issue replies for a beta.++**Promoting** is the normal stable release of `0.11.0`. Its bump clears `SCULPTFORGE_PRERELEASE`, so it is a new commit+after the beta's. Step `site` removes the `channels.preview` entry the stable release has caught up with. In the+app, Preview never offers anything older than stable. The beta's tag doesn't get in the way: stable releases take+the guide from the newest tag without a `-` (pages.yml). A second beta is `0.11.0-beta.2`.+## When a step failsThe script stops with a line starting `fix:` and the command to resume (`--from <step>`). Fix that one thing, thendiff --git a/scripts/release.sh b/scripts/release.shindex 6eb27795..255e82ac 100755--- a/scripts/release.sh+++ b/scripts/release.sh@@ -7,6 +7,8 @@# HIGHLIGHTS=notes.txt scripts/release.sh X.Y.Z --yes every step, in order (the normal way: one command)# scripts/release.sh X.Y.Z --from site resume at a step (after fixing what stopped it)# scripts/release.sh X.Y.Z --only replies one step+# HIGHLIGHTS=f scripts/release.sh X.Y.Z-beta.N --yes a beta (also -rc.N): a GitHub pre-release for testers, offered+# only to apps on the Preview update channel (see "Betas" below and docs/releasing.md)# HIGHLIGHTS=file the update feed's 3-5 highlight lines, one per line (default: the version's highlight: lines in# What's New and the note fragments, tools/release/assemble_notes.py X.Y.Z --highlights)# (the home page's What's New area is written by tools/guide/build_site.py from docs/guide/whats-new.md: the@@ -18,6 +20,11 @@# Each step looks at the live state first and skips what is already done, so running it again is always safe.# When something is wrong it stops and prints the fix; fix it, then run again with --from <that step>.# It never posts issue replies: it writes drafts for a person to read and post.+# Betas: steps bump check ci tag release preview status. bump sets CMakeLists.txt to X.Y.Z with+# SCULPTFORGE_PRERELEASE "beta.N" (the app says "X.Y.Z Beta N"; CHANGELOG, CITATION, metainfo and the home page stay+# at the stable release); preview writes channels.preview in website/latest.json (the stable top level is untouched);+# the Discord announcement workflow posts the beta once the feed names it. No site, AUR, Homebrew, Omarchy, winget or+# issue replies. The stable release later is plain scripts/release.sh X.Y.Z, which clears the prerelease.# Needs: gh logged in as islandmed (gh auth status), git, curl, python3, sha256sum (or shasum); run it from a clean# checkout of main. Pushes to main and the tag are made here, so only the release coordinator runs it, after# Tony's "ship it" for this version.@@ -49,7 +56,10 @@ confirm() {}V=${1:-}-[[ "$V" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "usage: scripts/release.sh X.Y.Z [--from STEP | --only STEP]"; exit 2; }+[[ "$V" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-((beta|rc)\.[0-9]+))?$ ]] ||+ { echo "usage: scripts/release.sh X.Y.Z[-beta.N|-rc.N] [--from STEP | --only STEP] [--yes]"; exit 2; }+BASE=${BASH_REMATCH[1]} PRE=${BASH_REMATCH[3]} # 0.11.0-beta.1: BASE 0.11.0, PRE beta.1; a stable release: PRE ""+[ -z "$PRE" ] || STEPS=(bump check ci tag release preview status)shiftFROM=bump ONLY=while [ $# -gt 0 ]; do@@ -140,9 +150,12 @@ gh_file() { gh api "repos/$1/contents/$2${3:+?ref=$3}" -q .content 2>/dev/null |# The home page's "new in X.Y.Z" card and "New in X.Y.Z:" lede in #whats-new, written by build_site.py (step bump) from# the version's ```features block in whats-new.md, which needs a date and a tagline.card_ok() { grep -qF "<small>new in $V</small>" website/index.html && grep -qF "class=\"section-lede\">New in $V:" website/index.html; }-features_ok() { awk -v v="## Version $V" '$0==v{f=1;next} f&&/^## /{exit} f' docs/guide/whats-new.md | grep -q '^tagline: .'; }+features_ok() { awk -v v="## Version $BASE" '$0==v{f=1;next} f&&/^## /{exit} f' docs/guide/whats-new.md | grep -q '^tagline: .'; }card_fix="give '## Version $V' in docs/guide/whats-new.md a \`\`\`features block (date: unreleased, tagline: ..., highlight: ..., cards), commit, push main, run again"-feed_done() { grep -qF "\"version\": \"$V\"" website/latest.json; }+feed_done() { grep -qF "\"version\": \"$V\"" website/latest.json; } # (a beta's is in channels.preview)+# A beta's entry in the update feed: channels.preview (old apps and the Stable channel read only the top level).+preview_done() { python3 -c 'import json, sys; sys.exit(json.load(open("website/latest.json")).get("channels", {}).get("preview", {}).get("version") != sys.argv[1])' "$V" 2>/dev/null; }+prerelease_is() { grep -qx "set(SCULPTFORGE_PRERELEASE \"$1\")" CMakeLists.txt; }# HIGHLIGHTS names a file of 3-5 non-empty lines.highlights_ok() {local n@@ -154,10 +167,10 @@ highlights_fix="write 3-5 one-line highlights (what users get) to a file and run# The words people write for What's New: the guide section and the UI test that expects it.words_ok() {python3 tools/release/assemble_notes.py --check >/dev/null || die "a note fragment in changes/ doesn't parse: $(python3 tools/release/assemble_notes.py --check 2>&1)" "fix it (changes/README.md has the format), commit, push main"- grep -q "^## Version ${V//./\\.}\$" docs/guide/whats-new.md || grep -qs '^whats_new:' changes/*.md ||- die "docs/guide/whats-new.md has no '## Version $V'" "write that section at the top (Help > What's New shows it), commit, push main"- grep -qF "expect_text \"Version $V\"" tests/ui/whats_new.sfui ||- die "tests/ui/whats_new.sfui doesn't check Version $V" "update its first expect_text lines to the new section (the version and one line from it), commit, push main"+ grep -q "^## Version ${BASE//./\\.}\$" docs/guide/whats-new.md || grep -qs '^whats_new:' changes/*.md ||+ die "docs/guide/whats-new.md has no '## Version $BASE'" "write that section at the top (Help > What's New shows it), commit, push main"+ grep -qF "expect_text \"Version $BASE\"" tests/ui/whats_new.sfui ||+ die "tests/ui/whats_new.sfui doesn't check Version $BASE" "update its first expect_text lines to the new section (the version and one line from it), commit, push main"}# UI scale / DPI (#87): the Windows manifest still asks for per-monitor DPI v2, and the "dpi" UI tests (100-200 %, a# display-scale event) pass on main's build. BUILD_DIR (default build) is the coordinator's tree, already built for@@ -183,12 +196,27 @@ preflight() {auth=$(gh auth status 2>&1 || true)grep -q "account $AUTHOR_NAME" <<<"$auth" || die "gh is not logged in as $AUTHOR_NAME" "gh auth login (or gh auth switch -u $AUTHOR_NAME)"words_ok+ grep -q '^set(SCULPTFORGE_PRERELEASE "[a-z0-9.]*")$' CMakeLists.txt ||+ die "CMakeLists.txt lost its set(SCULPTFORGE_PRERELEASE \"\") line that step bump sets" "restore it under project() (git log -p CMakeLists.txt), commit"+ python3 -c 'import json, sys; json.load(open(sys.argv[1]))' website/latest.json 2>/dev/null || die "website/latest.json is not valid JSON" "fix it, commit"+ if [ -n "$PRE" ]; then # a beta: the update feed's channels.preview, nothing else of the site, no packages+ if ! preview_done; then+ if [ -z "${HIGHLIGHTS:-}" ]; then+ HIGHLIGHTS=$(mktemp)+ python3 tools/release/assemble_notes.py "$BASE" --highlights >"$HIGHLIGHTS"+ highlights_ok || HIGHLIGHTS=+ fi+ highlights_ok || die "HIGHLIGHTS must name a file with 3-5 highlight lines for the beta's feed entry (now: '${HIGHLIGHTS:-unset}')" "$highlights_fix"+ fi+ ok "What's New $BASE and the highlights are ready for the beta (a beta has no site, package or reply steps)"+ return+ fi# site (bump writes the home page's card from the features block)card_ok || features_ok || die "docs/guide/whats-new.md: Version $V has no \`\`\`features block with a tagline" "$card_fix"if ! feed_done; thenif [ -z "${HIGHLIGHTS:-}" ]; then # the version's highlight lines (What's New features block + note fragments)HIGHLIGHTS=$(mktemp)- python3 tools/release/assemble_notes.py "$V" --highlights >"$HIGHLIGHTS"+ python3 tools/release/assemble_notes.py "$BASE" --highlights >"$HIGHLIGHTS"highlights_ok || HIGHLIGHTS=fihighlights_ok || die "HIGHLIGHTS must name a file with 3-5 highlight lines for the update feed (now: '${HIGHLIGHTS:-unset}')" "$highlights_fix"@@ -221,12 +249,16 @@ step_bump() {on_mainpreflight bumplocal out+ # A beta's #testers checklist comes from the fragments, so it is written before they go (step status names it).+ if [ -n "$PRE" ] && ls changes/*.md 2>/dev/null | grep -v '/README.md$' >/dev/null; then+ python3 tools/release/assemble_notes.py "$BASE" --testers >"release-testers-$V.md"+ fi# Note fragments (changes/<branch>.md) into CHANGELOG [Unreleased] and What's New X.Y.Z; the fragments go.- out=$(python3 tools/release/assemble_notes.py "$V" --apply 2>&1) || die "$out" "fix that fragment in changes/, commit, push main"+ out=$(python3 tools/release/assemble_notes.py "$BASE" --apply 2>&1) || die "$out" "fix that fragment in changes/, commit, push main"grep -q 'written' <<<"$out" && echo "$out" | sed 's/^/ notes: /'- out=$(python3 - "$V" "$TODAY" <<'PY'+ out=$(python3 - "$BASE" "$TODAY" "$PRE" <<'PY'import re, sys-v, today = sys.argv[1:]+v, today, pre = sys.argv[1:]ev = re.escape(v)new = {}@@ -245,7 +277,14 @@ def sub1(p, t, pat, rep):p = "CMakeLists.txt"; t = load(p)if not re.search(rf"^project\(SculptForge VERSION {ev}\b(?!\.)", t, re.M):- new[p] = sub1(p, t, r"^(project\(SculptForge VERSION )[0-9]+(?:\.[0-9]+)*", rf"\g<1>{v}")+ t = new[p] = sub1(p, t, r"^(project\(SculptForge VERSION )[0-9]+(?:\.[0-9]+)*", rf"\g<1>{v}")+if f'set(SCULPTFORGE_PRERELEASE "{pre}")' not in t: # a beta sets it, the stable release clears it+ new[p] = sub1(p, t, r'^set\(SCULPTFORGE_PRERELEASE "[^"]*"\)$', f'set(SCULPTFORGE_PRERELEASE "{pre}")')+if pre: # a beta: CITATION, metainfo, CHANGELOG, What's New's date and the home page wait for the stable release+ for p, t in new.items():+ open(p, "w", encoding="utf-8").write(t)+ print(p)+ sys.exit(0)p = "CITATION.cff"; t = load(p)if not re.search(rf"^version: {ev}$", t, re.M):@@ -289,8 +328,8 @@ for p, t in new.items(): # written only after every check passed, so a failurePY) || die "$out" "fix that file by hand (CHANGELOG entries and What's New are written by people), commit, push main"[ -n "$out" ] && echo "$out" | sed 's/^/ set: /'- python3 tools/guide/build_site.py >/dev/null # the guide, and the home page's What's New area for $V- card_ok || die "website/index.html has no 'new in $V' card after build_site.py" "$card_fix"+ python3 tools/guide/build_site.py >/dev/null # the guide, and the home page's What's New area for $V (not a beta's)+ [ -n "$PRE" ] || card_ok || die "website/index.html has no 'new in $V' card after build_site.py" "$card_fix"git add CMakeLists.txt CITATION.cff packaging/rez/package.py packaging/linux/org.sculptforge.SculptForge.metainfo.xml CHANGELOG.md website/index.html docs/guide/whats-new.mdgit add -A changesgit add -A website/guide@@ -298,7 +337,11 @@ PYok "every version file already says $V and the guide is built"returnfi- commit -m "Release $V: version files, CHANGELOG section, guide"+ if [ -n "$PRE" ]; then+ commit -m "Beta $V: CMake version $BASE $PRE, notes, guide"+ else+ commit -m "Release $V: version files, CHANGELOG section, guide"+ fipush_mainok "version files at $V, guide rebuilt, pushed main $(git rev-parse --short HEAD)"}@@ -307,6 +350,19 @@ step_check() {on_mainpreflightlocal bump="run step bump: scripts/release.sh $V --only bump (it sets every version file)"+ grep -q "^project(SculptForge VERSION ${BASE//./\\.}[ )]" CMakeLists.txt || die "CMakeLists.txt is not at $BASE" "$bump"+ prerelease_is "$PRE" || die "CMakeLists.txt's SCULPTFORGE_PRERELEASE is not \"$PRE\"" "$bump"+ if [ -n "$PRE" ]; then+ python3 tools/guide/build_site.py >/dev/null+ [ -z "$(git status --porcelain -- website/guide website/index.html)" ] ||+ die "website/guide is not rebuilt from docs/guide, or the home page changed (a beta leaves it alone)" "$bump"+ if git rev-parse -q --verify "refs/tags/$T" >/dev/null && [ "$(git rev-list -n1 "$T")" != "$(git rev-parse HEAD)" ]; then+ die "$T already tags $(git rev-list -n1 "$T"), not main's $(git rev-parse --short HEAD)" "if that is the beta, continue: scripts/release.sh $V --from release; if not, use the next number ($BASE-${PRE%.*}.$((${PRE##*.} + 1)))"+ fi+ ok "CMakeLists.txt says $BASE $PRE and the guide is built at $(git rev-parse --short HEAD)"+ dpi_ok+ return+ figrep -q "^project(SculptForge VERSION ${V//./\\.}[ )]" CMakeLists.txt || die "CMakeLists.txt is not at $V" "$bump"grep -q "^## \[${V//./\\.}\]" CHANGELOG.md || die "CHANGELOG.md has no '## [$V] - date' section" "$bump"grep -qF "<release version=\"$V\"" packaging/linux/org.sculptforge.SculptForge.metainfo.xml || die "metainfo has no <release version=\"$V\">" "$bump"@@ -339,7 +395,7 @@ step_tag() {if gh api "repos/$REPO/git/ref/tags/$T" >/dev/null 2>&1; then ok "$T is already pushed"; return; filocal shasha=$(git rev-parse HEAD)- confirm "Tag $T at $(git log -1 --format='%h %s' "$sha") and push it? This publishes SculptForge $V." ||+ confirm "Tag $T at $(git log -1 --format='%h %s' "$sha") and push it? This publishes SculptForge $V${PRE:+ as a GitHub pre-release for testers}." ||die "not confirmed" "run again and answer y (or YES=1) once Tony has said ship it for $V"git rev-parse -q --verify "refs/tags/$T" >/dev/null || git tag "$T" "$sha"gitp push -q origin "$T" || die "pushing $T failed" "git push origin $T (check gh auth status)"@@ -388,6 +444,14 @@ if not 3 <= len(lines) <= 5:with open("website/latest.json", encoding="utf-8") as f:feed = json.load(f)feed["version"], feed["highlights"] = v, lines+def key(s): # 0.11.0-beta.1 < 0.11.0, as src/core/UpdateCheck.cpp orders them+ n, _, pre = s.partition("-")+ return [int(x) for x in n.split(".")], (0, pre) if pre else (1, "")+pv = feed.get("channels", {}).get("preview", {}).get("version", "")+if pv and key(pv) <= key(v): # stable passed the beta: Preview is offered stable (the app checks this too)+ del feed["channels"]["preview"]+ if not feed["channels"]:+ del feed["channels"]with open("website/latest.json", "w", encoding="utf-8") as f:json.dump(feed, f, indent=2, ensure_ascii=False)f.write("\n")@@ -506,7 +570,54 @@ step_replies() {ok "drafts for $(echo "$issues" | wc -w) issues in $out: read them, then post with gh issue comment / close"}+step_preview() {+ release_ready+ on_main+ if preview_done; then+ ok "website/latest.json's channels.preview already says $V"+ else+ if [ -z "${HIGHLIGHTS:-}" ]; then # (a run that started here) What's New's highlight lines for the version+ HIGHLIGHTS=$work/highlights+ python3 tools/release/assemble_notes.py "$BASE" --highlights >"$HIGHLIGHTS"+ fi+ highlights_ok || die "the feed's preview entry needs this beta's highlights" "$highlights_fix --from preview"+ python3 - "$V" "$HIGHLIGHTS" "https://github.com/$REPO/releases/tag/$T" <<'PY'+import json, sys+v, notes, url = sys.argv[1:]+lines = [l.strip() for l in open(notes, encoding="utf-8") if l.strip()]+if not 3 <= len(lines) <= 5:+ sys.exit(f"{notes}: want 3-5 highlight lines, found {len(lines)}")+with open("website/latest.json", encoding="utf-8") as f:+ feed = json.load(f)+feed.setdefault("channels", {})["preview"] = {+ "version": v, "download": url, "notes": "https://sculptforge.app/guide/whats-new.html", "highlights": lines}+with open("website/latest.json", "w", encoding="utf-8") as f:+ json.dump(feed, f, indent=2, ensure_ascii=False)+ f.write("\n")+PY+ git add website/latest.json+ commit -m "Update feed: $V on the Preview channel"+ push_main+ ok "pushed channels.preview (the stable top level is unchanged)"+ fi+ wait_live https://sculptforge.app/latest.json "\"version\": \"$V\"" 600 ||+ die "sculptforge.app still serves the old feed after 10 minutes" "check the Website workflow: gh run list -R $REPO -w pages.yml -L 3; re-run it if it failed"+ ok "sculptforge.app/latest.json offers $V on the Preview channel"+}+step_status() {+ if [ -n "$PRE" ]; then+ echo " Beta: https://github.com/$REPO/releases/tag/$T (a pre-release: releases/latest stays on stable)"+ echo " Discord: the Discord announcement workflow posts it in #announcements with how to send feedback"+ echo " (gh run list -R $REPO -w discord-announce.yml -L 1)"+ if [ -f "release-testers-$V.md" ]; then+ echo " Testers: $PWD/release-testers-$V.md (read it, then post it in #testers)"+ else+ echo " Testers: no checklist (the note fragments had no testers: lines)"+ fi+ echo " Stable: when testers are happy: HIGHLIGHTS=f scripts/release.sh $BASE --yes (clears the prerelease)"+ return+ filocal wingetwinget=$(gh pr view 464465 -R microsoft/winget-pkgs --json state -q .state 2>/dev/null || echo unknown)echo " winget-pkgs#464465: $winget (update it once it merges; waits on the CLA)"diff --git a/src/app/App.cpp b/src/app/App.cppindex 8176a49f..68c1e45a 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -2471,6 +2471,7 @@ void App::updateTitle() {? std::string("Untitled"): std::filesystem::path(std::u8string(doc_.path.begin(), doc_.path.end())).filename().string();std::string title = (doc_.dirty() ? "* " : "") + name + " - SculptForge";+ if (*appPrerelease()) title += " " + appVersionLabel(); // "- SculptForge 0.11.0 Beta 1": a beta says soif (title == windowTitle_) return; // called every framewindowTitle_ = title;SDL_SetWindowTitle(window_, title.c_str());@@ -2542,7 +2543,7 @@ void App::drawUi() {ImGui::SetNextWindowSize(ImVec2(460 * uiScale_, 0), ImGuiCond_Always);ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));if (ImGui::Begin("About SculptForge", &showAbout_, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) {- ImGui::Text("SculptForge %s", SCULPTFORGE_VERSION);+ ImGui::Text("SculptForge %s", appVersionLabel().c_str());ImGui::TextWrapped("Free and open-source digital sculpting.");ImGui::Spacing();ImGui::TextWrapped("%s", ai::kPrivacyLine); // also on the site (website/index.html) and in docs/ai-services.mddiff --git a/src/app/App.h b/src/app/App.hindex a4a5ed30..4821abbe 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -1219,11 +1219,15 @@ private:};void startUpdateCheck(bool manual);void pollUpdateCheck();+ static const char* appPrerelease(); // "beta.1" in a beta build, else ""+ static std::string appFullVersion(); // "0.11.0-beta.1": what the update check compares+ static std::string appVersionLabel(); // "0.11.0 Beta 1": title bar (betas only) and Aboutvoid drawUpdateBanner();void drawUpdatesSection(); // Preferences > Updatesbool checkUpdates_ = true;int64_t updateCheckedAt_ = 0; // unix time of the last automatic checkstd::string updateSkipped_; // "Skip this version"+ UpdateChannel updateChannel_ = appPrerelease()[0] ? UpdateChannel::Preview : UpdateChannel::Stable; // a beta stays on betasstd::shared_ptr<UpdateJob> updateJob_;std::optional<UpdateInfo> updateAvailable_; // shown as the banner until dismissedstd::string updateStatus_; // the last check's result, for Preferences > Updatesdiff --git a/src/app/PanelProject.cpp b/src/app/PanelProject.cppindex baf6ebe3..c4219953 100644--- a/src/app/PanelProject.cpp+++ b/src/app/PanelProject.cpp@@ -106,6 +106,8 @@ void App::initProject() {checkUpdates_ = prefs["check_updates"].asBool(checkUpdates_);updateCheckedAt_ = int64_t(prefs["update_checked_at"].asNumber(0));if (prefs["update_skipped"].isString()) updateSkipped_ = prefs["update_skipped"].asString();+ if (prefs["update_channel"].isString())+ updateChannel_ = prefs["update_channel"].asString() == "preview" ? UpdateChannel::Preview : UpdateChannel::Stable;sculptSeconds_ = addSculptTime(prefs["sculpt_seconds"].asNumber(0.0), 0.0);supportReminderDone_ = prefs["support_reminder_done"].asBool(false);supportCardPrefs_.enabled = prefs["support_card"].asBool(true);@@ -176,6 +178,7 @@ void App::saveProjectPrefs() {prefs.set("check_updates", checkUpdates_);prefs.set("update_checked_at", double(updateCheckedAt_));if (!updateSkipped_.empty()) prefs.set("update_skipped", updateSkipped_);+ prefs.set("update_channel", std::string(updateChannel_ == UpdateChannel::Preview ? "preview" : "stable"));prefs.set("sculpt_seconds", std::floor(sculptSeconds_)); // for the one support reminder (Support.h); stays hereprefs.set("support_reminder_done", supportReminderDone_);prefs.set("support_card", supportCardPrefs_.enabled); // the support card at launch (Support.h)@@ -682,6 +685,16 @@ void App::drawProjectPopups() {// --- Update check ---+#ifndef SCULPTFORGE_PRERELEASE+#define SCULPTFORGE_PRERELEASE ""+#endif++const char* App::appPrerelease() { return SCULPTFORGE_PRERELEASE; }+std::string App::appFullVersion() {+ return std::string(SCULPTFORGE_VERSION) + (*SCULPTFORGE_PRERELEASE ? std::string("-") + SCULPTFORGE_PRERELEASE : "");+}+std::string App::appVersionLabel() { return versionLabel(SCULPTFORGE_VERSION, SCULPTFORGE_PRERELEASE); }+void App::startUpdateCheck(bool manual) {if (updateJob_) return; // one at a timeauto job = std::make_shared<UpdateJob>();@@ -694,7 +707,8 @@ void App::startUpdateCheck(bool manual) {const char* feed = std::getenv("SF_UPDATE_FEED");std::string source = feed && *feed ? feed : kUpdateFeedUrl;// Detached: a slow network never holds up quitting (the job is shared, so it outlives the app if it must).- std::thread([job, source] {+ const UpdateChannel channel = updateChannel_;+ std::thread([job, source, channel] {std::string body;if (source.rfind("https://", 0) == 0 || source.rfind("http://", 0) == 0) {ai::HttpResponse r = ai::httpRequest("GET", source, {"Accept: application/json"}, {}, 15);@@ -707,7 +721,7 @@ void App::startUpdateCheck(bool manual) {if (f) body.assign(std::istreambuf_iterator<char>(f), {});else job->error = "can't read " + source;}- if (job->error.empty()) job->ok = parseUpdateFeed(body, job->info, job->error);+ if (job->error.empty()) job->ok = parseUpdateFeed(body, job->info, job->error, channel);job->done = true;}).detach();}@@ -722,8 +736,8 @@ void App::pollUpdateCheck() {return;}const UpdateInfo& u = job->info;- if (compareVersions(u.version, SCULPTFORGE_VERSION) <= 0) {- updateStatus_ = "SculptForge " SCULPTFORGE_VERSION " is the newest version";+ if (compareVersions(u.version, appFullVersion()) <= 0) {+ updateStatus_ = "SculptForge " + appVersionLabel() + " is the newest version";if (job->manual) status_ = updateStatus_;return;}@@ -751,7 +765,7 @@ void App::drawUpdateBanner() {if (guide_.bodyBoldFont()) ImGui::PopFont();if (ImFont* body = guide_.bodyFont()) ImGui::PushFont(body);ImGui::SameLine();- ImGui::TextDisabled(tr("(you have %s)"), SCULPTFORGE_VERSION);+ ImGui::TextDisabled(tr("(you have %s)"), appVersionLabel().c_str());for (const auto& h : u.highlights) ImGui::BulletText("%s", h.c_str());ImGui::TextDisabled("%s", kFreeReleaseNote); // memberships (Support.h): releases stay free for everyoneif (guide_.bodyFont()) ImGui::PopFont();@@ -785,6 +799,21 @@ void App::drawUpdatesSection() {"Once a day at startup, download a small file from the SculptForge website that names the newest ""version, and show a banner when there is a newer one. Nothing about you or your computer is sent.","Preferences > Updates");+ ImGui::TextUnformatted(tr("Update channel"));+ int channel = updateChannel_ == UpdateChannel::Preview ? 1 : 0;+ bool changed = ImGui::RadioButton(tr("Stable"), &channel, 0);+ ImGui::SameLine();+ changed |= ImGui::RadioButton(tr("Preview (betas)"), &channel, 1);+ ui::HelpText("Update channel", nullptr,+ "Stable offers only finished releases. Preview also offers the betas: the next version a couple of "+ "weeks before it ships, for trying it out and reporting what goes wrong (Discord #bug-reports). When "+ "the stable release passes the beta, Preview offers that.",+ "Preferences > Updates");+ if (changed) {+ updateChannel_ = channel ? UpdateChannel::Preview : UpdateChannel::Stable;+ updateSkipped_.clear();+ saveProjectPrefs();+ }#elseImGui::TextWrapped("%s", tr("This build gets its updates from your package manager."));#endifdiff --git a/src/core/UpdateCheck.cpp b/src/core/UpdateCheck.cppindex 6aeeb394..e94fe0fc 100644--- a/src/core/UpdateCheck.cpp+++ b/src/core/UpdateCheck.cpp@@ -27,9 +27,56 @@ std::vector<uint64_t> versionParts(const std::string& v) {return parts;}+// The prerelease after the numbers ("beta.1" in "0.11.0-beta.1"), "" when there is none.+std::string prerelease(const std::string& v) {+ const size_t dash = v.find('-');+ if (dash == std::string::npos || versionParts(v.substr(0, dash)).empty()) return {};+ return v.substr(dash + 1, v.find('+', dash) - dash - 1);+}++bool allDigits(const std::string& s) {+ return !s.empty() && std::all_of(s.begin(), s.end(), [](char c) { return std::isdigit(static_cast<unsigned char>(c)); });+}++// SemVer's prerelease order: dot-separated, numbers numerically and below words, words as text, fewer parts first.+int comparePrerelease(const std::string& a, const std::string& b) {+ if (a.empty() || b.empty()) return a.empty() == b.empty() ? 0 : a.empty() ? 1 : -1; // none sorts above any+ size_t i = 0, j = 0;+ while (i <= a.size() && j <= b.size()) {+ const size_t ei = std::min(a.find('.', i), a.size()), ej = std::min(b.find('.', j), b.size());+ const std::string x = a.substr(i, ei - i), y = b.substr(j, ej - j);+ if (x != y) {+ const bool nx = allDigits(x), ny = allDigits(y);+ if (nx && ny) {+ if (x.size() != y.size()) return x.size() < y.size() ? -1 : 1;+ return x < y ? -1 : 1;+ }+ if (nx != ny) return nx ? -1 : 1;+ return x < y ? -1 : 1;+ }+ i = ei + 1, j = ej + 1;+ if (i > a.size() || j > b.size()) return i > a.size() && j > b.size() ? 0 : i > a.size() ? -1 : 1;+ }+ return 0;+}++// One release out of the feed (its top level or a channel's entry); false when it lacks a version or https link.+bool readRelease(const Json& j, UpdateInfo& info) {+ if (!j.isObject()) return false;+ if (j["version"].isString()) info.version = j["version"].asString();+ if (j["download"].isString()) info.downloadUrl = j["download"].asString();+ if (j["notes"].isString()) info.notesUrl = j["notes"].asString();+ if (versionParts(info.version).empty() || !httpsUrl(info.downloadUrl)) return false;+ if (!httpsUrl(info.notesUrl)) info.notesUrl = info.downloadUrl;+ for (const auto& h : j["highlights"].items())+ if (h.isString() && !h.asString().empty() && info.highlights.size() < 4)+ info.highlights.push_back(h.asString().substr(0, 200));+ return true;+}+} // namespace-bool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& error) {+bool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& error, UpdateChannel channel) {Json j;if (!Json::parse(json, j, error)) return false;if (!j.isObject()) {@@ -37,21 +84,16 @@ bool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& erroreturn false;}UpdateInfo info;- if (j["version"].isString()) info.version = j["version"].asString();- if (j["download"].isString()) info.downloadUrl = j["download"].asString();- if (j["notes"].isString()) info.notesUrl = j["notes"].asString();- if (versionParts(info.version).empty()) {- error = "the update feed has no version";+ if (!readRelease(j, info)) {+ error = versionParts(info.version).empty() ? "the update feed has no version"+ : "the update feed has no https download link";return false;}- if (!httpsUrl(info.downloadUrl)) {- error = "the update feed has no https download link";- return false;+ if (channel == UpdateChannel::Preview && j["channels"].isObject()) {+ UpdateInfo preview;+ if (readRelease(j["channels"]["preview"], preview) && compareVersions(preview.version, info.version) > 0)+ info = std::move(preview); // never older than stable: once stable passes the beta, it is offered}- if (!httpsUrl(info.notesUrl)) info.notesUrl = info.downloadUrl;- for (const auto& h : j["highlights"].items())- if (h.isString() && !h.asString().empty() && info.highlights.size() < 4)- info.highlights.push_back(h.asString().substr(0, 200));out = std::move(info);return true;}@@ -62,7 +104,22 @@ int compareVersions(const std::string& a, const std::string& b) {const uint64_t x = i < pa.size() ? pa[i] : 0, y = i < pb.size() ? pb[i] : 0;if (x != y) return x < y ? -1 : 1;}- return 0;+ return comparePrerelease(prerelease(a), prerelease(b));+}++std::string versionLabel(const std::string& version, const std::string& prerelease) {+ if (prerelease.empty()) return version;+ std::string label = version;+ size_t i = 0;+ while (i <= prerelease.size()) { // "beta.1" -> " Beta 1", "rc.2" -> " RC 2"+ const size_t e = std::min(prerelease.find('.', i), prerelease.size());+ std::string part = prerelease.substr(i, e - i);+ if (part == "rc") part = "RC";+ else if (!part.empty()) part[0] = char(std::toupper(static_cast<unsigned char>(part[0])));+ if (!part.empty()) label += " " + part;+ i = e + 1;+ }+ return label;}} // namespace sfdiff --git a/src/core/UpdateCheck.h b/src/core/UpdateCheck.hindex 3841a6e9..6ecc9d6b 100644--- a/src/core/UpdateCheck.h+++ b/src/core/UpdateCheck.h@@ -23,13 +23,24 @@ struct UpdateInfo {std::vector<std::string> highlights; // a few short lines for the banner};-// Reads the feed; false (with `error`) when it isn't one: the version and an https download link are required.-bool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& error);+// Which releases the update check offers (Preferences > Updates): Stable, or Preview, which adds the betas+// (the feed's channels.preview, published by scripts/release.sh X.Y.Z-beta.N).+enum class UpdateChannel { Stable, Preview };-// Compares dotted version numbers ("0.10.0" > "0.9.2"; a missing part counts as 0, text after the numbers such as-// "-rc1" is ignored): < 0, 0 or > 0.+// Reads the feed; false (with `error`) when it isn't one: the version and an https download link are required.+// On Preview the feed's channels.preview entry is offered when it is newer than the stable release; otherwise (and+// when the entry is missing or broken) the top level, which is what Stable reads.+bool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& error,+ UpdateChannel channel = UpdateChannel::Stable);++// Compares dotted version numbers ("0.10.0" > "0.9.2"; a missing part counts as 0): < 0, 0 or > 0. A prerelease+// sorts below its version, and its parts compare like SemVer's: 0.11.0-beta.1 < 0.11.0-beta.2 < 0.11.0-rc.1 < 0.11.0.+// "+build" text is ignored.int compareVersions(const std::string& a, const std::string& b);+// What people read: "0.11.0" and "beta.1" make "0.11.0 Beta 1" (title bar, About); no prerelease, the version.+std::string versionLabel(const std::string& version, const std::string& prerelease);+// The check runs when the last one is a day old (or in the future: the clock was changed).inline bool updateCheckDue(int64_t lastCheck, int64_t now) {return lastCheck <= 0 || now < lastCheck || now - lastCheck >= kUpdateCheckInterval;diff --git a/tests/release_beta_test.sh b/tests/release_beta_test.shnew file mode 100755index 00000000..6a0adb8c--- /dev/null+++ b/tests/release_beta_test.sh@@ -0,0 +1,152 @@+#!/usr/bin/env bash+# SculptForge - open source digital sculpting+# SPDX-License-Identifier: GPL-3.0-or-later+#+# scripts/release.sh's beta path, run for real in a sandbox (ctest release_script_beta): a shared clone of this+# checkout (with its uncommitted changes), a bare repository as origin, and stand-ins for gh, curl, cmake and ctest,+# so nothing reaches GitHub, the website or the build. It releases 0.11.0-beta.1 (steps bump check preview status),+# then promotes it to 0.11.0 (bump check site) with the beta tag present, and checks what each one may and may not+# touch (docs/releasing.md, "Betas").+set -euo pipefail++ROOT=$(cd "$(dirname "$0")/.." && pwd)+S=$(mktemp -d)+trap 'rm -rf "$S"' EXIT+fail() { echo "FAIL: $*" >&2; exit 1; }+quiet() { "$@" >"$S/out.log" 2>&1 || { cat "$S/out.log" >&2; fail "$* exited $?"; }; }++# --- the sandbox -----------------------------------------------------------------------------------------------------+git clone -q --shared --no-checkout "$ROOT" "$S/repo"+cd "$S/repo"+git sparse-checkout set --no-cone /CMakeLists.txt /CHANGELOG.md /CITATION.cff /packaging/ /docs/ /tools/ /website/ \+ /scripts/ /changes/ /tests/ui/whats_new.sfui+git checkout -q -B main "$(git -C "$ROOT" rev-parse HEAD)"+# This checkout's uncommitted changes (the tree being tested), then one commit on main.+(cd "$ROOT" && git diff --name-only HEAD -- CMakeLists.txt CHANGELOG.md packaging docs tools website scripts changes tests/ui/whats_new.sfui) |+ while read -r f; do+ if [ -e "$ROOT/$f" ]; then mkdir -p "$(dirname "$f")" && cp "$ROOT/$f" "$f"; else rm -f "$f"; fi+ done+git config user.name test && git config user.email [email protected]+rm -f changes/[!R]*.md # this branch's own fragments: the test writes its own+mkdir -p changes+cat > changes/beta-test.md <<'EOF'+---+whats_new: **Beta test feature**: something new to try.+highlight: First highlight of the beta+highlight: Second highlight of the beta+highlight: Third highlight of the beta+added: **Beta test feature**: something new to try.+testers:+ - Windows, 150% scaling: open the beta test feature and try it.+---+EOF+echo '# expect_text "Version 0.11.0"' >> tests/ui/whats_new.sfui # words_ok wants the UI test to check the version+git add -A . && git commit -q -m "sandbox"+git init -q --bare "$S/origin.git"+git remote set-url origin "$S/origin.git"+git push -q origin main++# Stand-ins: gh answers the few questions the tested steps ask; curl serves the sandbox's own site.+mkdir -p "$S/bin" "$S/home" "$S/build"+touch "$S/build/CTestTestfile.cmake"+cat > "$S/bin/gh" <<EOF+#!/usr/bin/env bash+case "\$*" in+ "auth status"*) echo "Logged in to github.com account islandmed" ;;+ "release view"*) echo SHA256SUMS.txt ;;+ "release download"*) exit 1 ;;+ *homebrew-tap*) printf ' version "0.10.10"\n' | base64 ;;+ "pr view 1800"*) echo "OPEN islandmed sculptforge-bump" ;;+ *omarchy-pkgs/contents*) printf "sha256sums=('%064d')\n" 0 | base64 ;;+ *) echo "gh stand-in: unexpected gh \$*" >&2; exit 1 ;;+esac+EOF+cat > "$S/bin/curl" <<EOF+#!/usr/bin/env bash+for a in "\$@"; do+ case "\$a" in+ https://sculptforge.app/latest.json*) git -C "$S/origin.git" show main:website/latest.json; exit ;;+ https://sculptforge.app/guide/whats-new.html*) git -C "$S/origin.git" show main:docs/guide/whats-new.md; exit ;;+ esac+done+echo "curl stand-in: unexpected curl \$*" >&2; exit 1+EOF+printf '#!/bin/sh\nexit 0\n' > "$S/bin/cmake"+printf '#!/bin/sh\nexit 0\n' > "$S/bin/ctest"+chmod +x "$S/bin/"*+export PATH="$S/bin:$PATH" HOME="$S/home" BUILD_DIR="$S/build" YES=1+unset HIGHLIGHTS++before() { git show "$1:$2"; }+stable_files="CITATION.cff packaging/rez/package.py packaging/linux/org.sculptforge.SculptForge.metainfo.xml website/index.html packaging/arch/PKGBUILD"++# --- usage ---------------------------------------------------------------------------------------------------------+for bad in 0.11.0-beta 0.11.0-beta.x 0.11.0-alpha.1 v0.11.0-beta.1 0.11; do+ if scripts/release.sh "$bad" --only status >/dev/null 2>&1; then fail "release.sh accepted '$bad'"; fi+done++# --- the beta ------------------------------------------------------------------------------------------------------+start=$(git rev-parse HEAD)+quiet scripts/release.sh 0.11.0-beta.1 --only bump+grep -q '^project(SculptForge VERSION 0.11.0 ' CMakeLists.txt || fail "beta bump: CMakeLists.txt is not at 0.11.0"+grep -qx 'set(SCULPTFORGE_PRERELEASE "beta.1")' CMakeLists.txt || fail "beta bump: no prerelease beta.1"+for f in $stable_files; do+ [ "$(before "$start" "$f")" = "$(cat "$f")" ] || fail "beta bump changed $f (a beta leaves it to the stable release)"+done+grep -q '^## \[0.11.0\]' CHANGELOG.md && fail "beta bump made a CHANGELOG [0.11.0] section"+grep -q 'Beta test feature' CHANGELOG.md || fail "beta bump: the fragment's entry is not in CHANGELOG [Unreleased]"+grep -q '^## Version 0.11.0$' docs/guide/whats-new.md || fail "beta bump: no What's New 0.11.0"+[ ! -e changes/beta-test.md ] || fail "beta bump: the fragment is still there"+grep -q 'open the beta test feature' release-testers-0.11.0-beta.1.md || fail "beta bump: no testers checklist"+[ "$(git rev-parse HEAD)" = "$(git -C "$S/origin.git" rev-parse main)" ] || fail "beta bump: main not pushed"++quiet scripts/release.sh 0.11.0-beta.1 --only check+grep -q 'CMakeLists.txt says 0.11.0 beta.1' "$S/out.log" || fail "beta check: $(cat "$S/out.log")"+quiet scripts/release.sh 0.11.0-beta.1 --only bump # again: nothing left to do+grep -q 'already says' "$S/out.log" || fail "beta bump is not idempotent: $(cat "$S/out.log")"++# A beta needs highlights for its feed entry: in What's New's block now (the fragment's went there).+quiet scripts/release.sh 0.11.0-beta.1 --only preview+python3 - <<'EOF' || fail "beta preview: wrong feed"+import json, subprocess+feed = json.loads(subprocess.run(["git", "show", "HEAD:website/latest.json"], capture_output=True, text=True).stdout)+old = json.loads(subprocess.run(["git", "show", "HEAD~1:website/latest.json"], capture_output=True, text=True).stdout)+p = feed["channels"]["preview"]+assert p["version"] == "0.11.0-beta.1", p+assert p["download"].endswith("/releases/tag/v0.11.0-beta.1"), p+assert p["highlights"][0] == "First highlight of the beta", p+assert feed["version"] == old["version"] and feed["highlights"] == old["highlights"], "the stable top level changed"+EOF+git diff --quiet HEAD~1 HEAD -- website/index.html || fail "beta preview touched the home page"+quiet scripts/release.sh 0.11.0-beta.1 --only status+grep -q 'release-testers-0.11.0-beta.1.md' "$S/out.log" || fail "beta status names no testers checklist"+grep -q 'scripts/release.sh 0.11.0 --yes' "$S/out.log" || fail "beta status doesn't say how to promote"+git tag v0.11.0-beta.1 "$(git rev-parse HEAD~1)" # what step tag would have pushed++# --- promoting it: the stable 0.11.0 with the beta tag present ------------------------------------------------------+# People give the version its tagline before the stable release (the home page card needs it).+python3 - <<'EOF'+p = "docs/guide/whats-new.md"+t = open(p, encoding="utf-8").read()+head = "## Version 0.11.0\n\n```features\ndate: unreleased\n"+assert head in t, "no 0.11.0 features block"+open(p, "w", encoding="utf-8").write(t.replace(head, head + "tagline: The beta, finished.\n", 1))+EOF+grep -q '^tagline: The beta, finished.$' docs/guide/whats-new.md || fail "test setup: couldn't add the tagline"+git commit -q -am "What's New 0.11.0 tagline" && git push -q origin main+quiet scripts/release.sh 0.11.0 --only bump+grep -qx 'set(SCULPTFORGE_PRERELEASE "")' CMakeLists.txt || fail "stable bump didn't clear the prerelease"+grep -q '^## \[0.11.0\] - ' CHANGELOG.md || fail "stable bump: no CHANGELOG [0.11.0]"+grep -qx 'version: 0.11.0' CITATION.cff || fail "stable bump: CITATION.cff not at 0.11.0"+grep -qF '<small>new in 0.11.0</small>' website/index.html || fail "stable bump: no home page card"+quiet scripts/release.sh 0.11.0 --only check+grep -q 'say 0.11.0 at' "$S/out.log" || fail "stable check after a beta: $(cat "$S/out.log")"+printf 'One\nTwo\nThree\n' >"$S/highlights.txt"+HIGHLIGHTS=$S/highlights.txt quiet scripts/release.sh 0.11.0 --only site+python3 - <<'EOF' || fail "stable site: wrong feed"+import json+feed = json.load(open("website/latest.json"))+assert feed["version"] == "0.11.0" and feed["highlights"] == ["One", "Two", "Three"], feed+assert "preview" not in feed.get("channels", {}), "the passed beta is still on the Preview channel"+EOF+echo "release.sh beta and promotion: ok"diff --git a/tests/test_guide.cpp b/tests/test_guide.cppindex ad1e22cc..87d620d5 100644--- a/tests/test_guide.cpp+++ b/tests/test_guide.cpp@@ -242,3 +242,16 @@ TEST(guide_whats_new_groups) {const whatsnew::Page next = whatsnew::build(doc, "0.10.8");CHECK(next.versions[0].version == "0.10.8" && !next.groups.empty() && next.groups[0].label == "0.10.1 to 0.10.5");}++TEST(guide_whats_new_in_a_beta) {+ // A beta (0.11.0 Beta 1) is built as 0.11.0 (SCULPTFORGE_VERSION; the prerelease is a separate define) while its+ // section still says "date: unreleased": Help > What's New shows that section, and the stable app doesn't.+ const guide::Document doc = parse("# What's new\n\n## Version 0.11.0\n\n```features\ndate: unreleased\n"+ "highlight: Beta: something new\n```\n\n- New.\n\n## Version 0.10.11\n\n"+ "```features\ndate: 2026-11-04\nhighlight: Stable: a fix\n```\n\n- Fixed.\n");+ const whatsnew::Page beta = whatsnew::build(doc, "0.11.0");+ CHECK(beta.problems.empty() && !beta.versions.empty() && beta.versions[0].version == "0.11.0");+ CHECK(!beta.versions.empty() && beta.versions[0].highlights.size() == 1);+ const whatsnew::Page stable = whatsnew::build(doc, "0.10.11");+ CHECK(!stable.versions.empty() && stable.versions[0].version == "0.10.11");+}diff --git a/tests/test_update_check.cpp b/tests/test_update_check.cppindex 873b9cdb..71715a27 100644--- a/tests/test_update_check.cpp+++ b/tests/test_update_check.cpp@@ -17,7 +17,8 @@ TEST(update_versions_compare_numerically) {CHECK(compareVersions("0.10.0", "0.9.2") > 0); // not as textCHECK(compareVersions("0.6", "0.6.0") == 0);CHECK(compareVersions("v0.6.1", "0.6.0") > 0);- CHECK(compareVersions("0.6.0-rc1", "0.6.0") == 0);+ CHECK(compareVersions("0.6.0-rc1", "0.6.0") < 0); // a prerelease comes before its version+ CHECK(compareVersions("0.6.0+build7", "0.6.0") == 0);CHECK(compareVersions("1.0.0", "0.99.99") > 0);CHECK(compareVersions("", "0.1.0") < 0);}@@ -35,6 +36,47 @@ TEST(update_feed_parses) {u.notesUrl == "https://example.org/dl" && u.highlights.empty());}+TEST(update_versions_order_prereleases) {+ CHECK(compareVersions("0.11.0-beta.1", "0.11.0") < 0);+ CHECK(compareVersions("0.11.0", "0.11.0-beta.1") > 0);+ CHECK(compareVersions("0.11.0-beta.1", "0.10.11") > 0);+ CHECK(compareVersions("0.11.0-beta.1", "0.11.0-beta.2") < 0);+ CHECK(compareVersions("0.11.0-beta.2", "0.11.0-beta.10") < 0); // numbers numerically+ CHECK(compareVersions("0.11.0-beta.2", "0.11.0-rc.1") < 0);+ CHECK(compareVersions("0.11.0-beta", "0.11.0-beta.1") < 0);+ CHECK(compareVersions("v0.11.0-beta.1", "0.11.0-beta.1") == 0);+ CHECK(versionLabel("0.11.0", "beta.1") == "0.11.0 Beta 1");+ CHECK(versionLabel("0.11.0", "rc.2") == "0.11.0 RC 2");+ CHECK(versionLabel("0.10.11", "") == "0.10.11");+}++// latest.json while 0.11.0 Beta 1 is out: old apps and Stable read the top level, Preview the channel's entry.+static const char* kPreviewFeed = R"({"version":"0.10.11","download":"https://sculptforge.app/#download",+ "highlights":["Stable one"],+ "channels":{"preview":{"version":"0.11.0-beta.1","download":"https://github.com/islandmed/SculptForge/releases/tag/v0.11.0-beta.1",+ "notes":"https://sculptforge.app/guide/whats-new.html","highlights":["Beta one","Beta two"]}}})";++TEST(update_feed_preview_channel) {+ UpdateInfo u;+ std::string err;+ CHECK(parseUpdateFeed(kPreviewFeed, u, err) && u.version == "0.10.11" && u.highlights.size() == 1); // Stable+ CHECK(parseUpdateFeed(kPreviewFeed, u, err, UpdateChannel::Preview));+ CHECK(u.version == "0.11.0-beta.1" && u.highlights.size() == 2 && u.highlights[0] == "Beta one");+ CHECK(u.downloadUrl.find("/releases/tag/v0.11.0-beta.1") != std::string::npos);+ // Once stable passes the beta, Preview is offered stable.+ std::string promoted = kPreviewFeed;+ promoted.replace(promoted.find("0.10.11"), 7, "0.11.0");+ CHECK(parseUpdateFeed(promoted, u, err, UpdateChannel::Preview) && u.version == "0.11.0");+ // A broken or missing preview entry falls back to stable; it never breaks the check.+ CHECK(parseUpdateFeed(R"({"version":"0.10.11","download":"https://example.org/dl",+ "channels":{"preview":{"version":"0.11.0-beta.1","download":"http://example.org"}}})",+ u, err, UpdateChannel::Preview) && u.version == "0.10.11");+ CHECK(parseUpdateFeed(R"({"version":"0.10.11","download":"https://example.org/dl","channels":[]})", u, err,+ UpdateChannel::Preview) && u.version == "0.10.11");+ CHECK(parseUpdateFeed(R"({"version":"0.10.11","download":"https://example.org/dl"})", u, err,+ UpdateChannel::Preview) && u.version == "0.10.11");+}+TEST(update_feed_rejects_bad_feeds) {UpdateInfo u;std::string err;diff --git a/tools/guide/build_site.py b/tools/guide/build_site.pyindex 3b00c154..fb4a28d8 100644--- a/tools/guide/build_site.py+++ b/tools/guide/build_site.py@@ -440,6 +440,12 @@ def project_version() -> str:return m.group(1) if m else ""+def project_prerelease() -> str:+ """CMakeLists.txt's SCULPTFORGE_PRERELEASE ("beta.1" while a beta of the project version is out, else "")."""+ m = re.search(r'^set\(SCULPTFORGE_PRERELEASE "([^"]*)"\)', (ROOT / "CMakeLists.txt").read_text(encoding="utf-8"), re.M)+ return m.group(1) if m else ""++def parse_features(text: str) -> dict:"""The features block: date, tagline, highlights, then cards (each starts with title:). Raises ValueError."""v = {"date": "", "tagline": "", "highlights": [], "cards": []}@@ -667,7 +673,10 @@ def home_whats_new(page: "WhatsNewPage") -> str:def write_home(page: "WhatsNewPage", check_only: bool) -> bool:- """Writes the release area into website/index.html; with CHECK_ONLY, True when it is already up to date."""+ """Writes the release area into website/index.html; with CHECK_ONLY, True when it is already up to date. A beta+ leaves the home page alone: it keeps showing the stable release until that version ships."""+ if project_prerelease():+ return Truet = HOME.read_text(encoding="utf-8")a = t.find(HOME_START)b = t.find(HOME_END, a)