feat(version): add release trains and --train to yt version update #97
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/YT-39-release-train-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bake the release train the binary was built on and update along it by default, matching
fj.build.rsemits a newYOUTRACK_CLI_TRAINcompile-time var alongside the existing git-hash / build-date / update-url vars; CI derives it from the workflow trigger with the same logic that already picks the publish channel (tag push ->release,mainpush ->latest) and threads it through as a--build-argin both build-linux.yml and build-windows.yml, plus an ARG/ENV pair in both Dockerfiles. Local cargo builds leave the var unset and default tolatest, since local dev tracksmain.Add a clap
Train { Release, Latest }value-enum and a--trainflag toUpdateArgs; when omitted it resolves to the baked train. Help text mirrorsfj("Override which release train to pull from; defaults to the train this binary was built on",[possible values: release, latest]) and the subcommand summary now reads "Replace the running binary with the latest build on its train".Resolve the download target per train in
update::run: thelatesttrain keeps{base}/latest/{filename}and downloads unconditionally (everymainpush republisheslatestat the same CARGO_PKG_VERSION, so semver cannot detect "newer"); thereleasetrain resolves the highest publishedv<semver>via YT-37'sfetch_latest_version, short-circuits when it is not newer than the running version (bypassed by--force), and downloads{base}/v<max>/{filename}via the newbuild_release_url.--urlstill overrides the base for both trains.Tests cover default-train resolution from the baked value,
--trainoverride for each value, the release-train versioned URL, the latest-train/latest/URL and its unconditional download, and the release-train short-circuit / no-release error paths.#YT-39
yt version updateBake the release train the binary was built on and update along it by default, matching `fj`. `build.rs` emits a new `YOUTRACK_CLI_TRAIN` compile-time var alongside the existing git-hash / build-date / update-url vars; CI derives it from the workflow trigger with the same logic that already picks the publish channel (tag push -> `release`, `main` push -> `latest`) and threads it through as a `--build-arg` in both build-linux.yml and build-windows.yml, plus an ARG/ENV pair in both Dockerfiles. Local cargo builds leave the var unset and default to `latest`, since local dev tracks `main`. Add a clap `Train { Release, Latest }` value-enum and a `--train` flag to `UpdateArgs`; when omitted it resolves to the baked train. Help text mirrors `fj` ("Override which release train to pull from; defaults to the train this binary was built on", `[possible values: release, latest]`) and the subcommand summary now reads "Replace the running binary with the latest build on its train". Resolve the download target per train in `update::run`: the `latest` train keeps `{base}/latest/{filename}` and downloads unconditionally (every `main` push republishes `latest` at the same CARGO_PKG_VERSION, so semver cannot detect "newer"); the `release` train resolves the highest published `v<semver>` via YT-37's `fetch_latest_version`, short-circuits when it is not newer than the running version (bypassed by `--force`), and downloads `{base}/v<max>/{filename}` via the new `build_release_url`. `--url` still overrides the base for both trains. Tests cover default-train resolution from the baked value, `--train` override for each value, the release-train versioned URL, the latest-train `/latest/` URL and its unconditional download, and the release-train short-circuit / no-release error paths. #YT-39