Files
wallet/script/stamp-version.sh
rob thijssen dff158e457
All checks were successful
ci / gate (push) Successful in 12m17s
release / linux (push) Successful in 14m25s
release / package (44) (push) Successful in 40s
release / publish (44) (push) Successful in 12s
fix(release): the workspace crates' exact pins move with the version
91ec5fb bumped the workspace to 0.2.0 but left wallet-entities,
wallet-core and wallet-data pinned to each other at =0.1.0, so Cargo.lock
no longer resolved. The pins are now =0.2.0, the lockfile follows, and
script/stamp-version.sh rewrites the pins from the workspace version so
the next bump cannot leave them behind. Gate run with --locked.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ftBXYuba8ARhQeF74oUgW
2026-09-16 19:24:11 +03:00

35 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Stamp the workspace version into the two files that cannot read it
# themselves: tauri.conf.json (Tauri's CLI wants a literal) and
# ui/package.json. Refuses a tag that disagrees with Cargo.toml, so the
# workspace stays the one source of truth and a release is a tag on it.
#
# script/stamp-version.sh # stamp from Cargo.toml
# script/stamp-version.sh v0.2.0 # also assert the tag matches
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
version="$(sed -nE 's/^version = "([^"]+)"$/\1/p' "${here}/Cargo.toml" | head -1)"
[ -n "${version}" ] || { echo "no workspace version in Cargo.toml" >&2; exit 1; }
if [ "${1:-}" != "" ]; then
tag="${1#v}"
if [ "${tag}" != "${version}" ]; then
echo "tag v${tag} does not match the workspace version ${version}; bump Cargo.toml first" >&2
exit 1
fi
fi
# The workspace's own crates pin each other exactly; keep the pins on the
# workspace version, or a bump leaves Cargo.lock unresolvable.
sed -i -E "s/^(wallet-[a-z]+ = \{ path = \"crates\/wallet-[a-z]+\", version = \")=[^\"]+(\" \})/\1=${version}\2/" "${here}/Cargo.toml"
python3 - "${version}" "${here}/crates/wallet-app/tauri.conf.json" "${here}/ui/package.json" <<'PY'
import json, sys
version, *files = sys.argv[1:]
for f in files:
with open(f) as fh:
d = json.load(fh)
d["version"] = version
with open(f, "w") as fh:
json.dump(d, fh, indent=2)
fh.write("\n")
print(f"{f}: {version}")
PY