#!/usr/bin/env sh # # Echo the version this build should carry. One definition, used in three places # (both bundle jobs and the manifest writer) — if they ever disagreed, the app would # compare its own version against a manifest describing a different build, and the # updater would either offer nothing or loop forever offering the same thing. # # WHY DEV BUILDS NEED THEIR OWN VERSION AT ALL: # an updater decides by comparing semver. Every dev build carries the version in # Cargo.toml, so without this they'd all be `0.1.0` — an installed build would see a # manifest advertising the version it already has, conclude it was current, and never # update. The rolling channel needs a number that actually rises. # # The CI run number is that number: monotonic, already unique per build, and it needs # no state carried between runs. `0.1.0` + run 2932 becomes `0.1.2932`. # # Plain semver on purpose, NOT a `-dev.N` prerelease tag: prerelease versions sort # BELOW the release they qualify (`0.1.0-dev.5` < `0.1.0`), so a tagged build would # never update to a newer dev one, and Windows installer metadata wants a numeric # X.Y.Z anyway. Bumping the minor in Cargo.toml still wins over any dev build on the # old line, which is the ordering you want: 0.2.0 > 0.1.2932. set -eu CARGO_TOML="$(dirname "$0")/../src-tauri/Cargo.toml" base="$(grep -m1 '^version' "$CARGO_TOML" | sed -E 's/.*"([^"]+)".*/\1/')" # Dev builds only. Anything else (a v* tag, main) ships the version as written. if [ "${GITHUB_REF_NAME:-}" = "dev" ] && [ -n "${GITHUB_RUN_NUMBER:-}" ]; then printf '%s.%s\n' "${base%.*}" "$GITHUB_RUN_NUMBER" else printf '%s\n' "$base" fi