Skip to content

Commit 0758fef

Browse files
gaoyu06claude
andcommitted
Release v0.1.11
- add a --version/-V/version flag (works without a TTY, used by the desktop's check_backend probe and the new CI guard) - release workflows now verify the built binary's version matches the tag / dispatch version before publishing, preventing a repeat of the v0.1.10 mislabeled-binary release - bump version to 0.1.11 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 3b9cbf4 commit 0758fef

5 files changed

Lines changed: 48 additions & 2 deletions

File tree

.github/workflows/release-macos.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,25 @@ jobs:
3535
- name: Build release binary
3636
run: cargo build --release --target ${{ matrix.target.rust_target }}
3737

38+
# Guard against the v0.1.10 incident: the npm package version is stamped
39+
# from the tag / dispatch input, so a binary built from a checkout whose
40+
# Cargo.toml wasn't bumped would ship mislabeled — and its self-update
41+
# check would nag users forever. Fail the release instead.
42+
- name: Verify binary version matches the release version
43+
shell: bash
44+
run: |
45+
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
46+
expected="${{ inputs.release_version }}"
47+
else
48+
expected="${GITHUB_REF_NAME#v}"
49+
fi
50+
actual="$(./target/${{ matrix.target.rust_target }}/release/jucode --version | awk '{print $NF}')"
51+
echo "expected=${expected} actual=${actual}"
52+
if [ "${actual}" != "${expected}" ]; then
53+
echo "::error::built binary reports ${actual} but the release is ${expected} — bump Cargo.toml (and commit) before tagging"
54+
exit 1
55+
fi
56+
3857
- name: Stage artifact
3958
shell: bash
4059
run: |

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ jobs:
3636
- name: Build release binary
3737
run: cargo build --release --target ${{ matrix.target.rust_target }}
3838

39+
# Guard against the v0.1.10 incident: the npm package version is stamped
40+
# from the tag / dispatch input, so a binary built from a checkout whose
41+
# Cargo.toml wasn't bumped would ship mislabeled — and its self-update
42+
# check would nag users forever. Fail the release instead.
43+
- name: Verify binary version matches the release version
44+
shell: bash
45+
run: |
46+
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
47+
expected="${{ inputs.release_version }}"
48+
else
49+
expected="${GITHUB_REF_NAME#v}"
50+
fi
51+
actual="$(./target/${{ matrix.target.rust_target }}/release/${{ matrix.target.binary_name }} --version | awk '{print $NF}')"
52+
echo "expected=${expected} actual=${actual}"
53+
if [ "${actual}" != "${expected}" ]; then
54+
echo "::error::built binary reports ${actual} but the release is ${expected} — bump Cargo.toml (and commit) before tagging"
55+
exit 1
56+
fi
57+
3958
- name: Stage artifact
4059
shell: bash
4160
run: |

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jucode-cli"
3-
version = "0.1.10"
3+
version = "0.1.11"
44
edition = "2021"
55

66
[[bin]]

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ impl TuiRuntime for Runtime {
5858
fn main() -> io::Result<()> {
5959
jucode_agent_core::logging::init_global();
6060
let mut args = env::args().skip(1).collect::<Vec<_>>();
61+
// Before anything that may touch the terminal: `--version` must work in
62+
// TTY-less contexts (CI release guard, the desktop's check_backend probe).
63+
if args.iter().any(|a| a == "--version" || a == "-V")
64+
|| args.first().map(String::as_str) == Some("version")
65+
{
66+
println!("jucode {}", env!("CARGO_PKG_VERSION"));
67+
return Ok(());
68+
}
6169
let approval_mode = match take_approval_mode_flag(&mut args) {
6270
Ok(mode) => mode,
6371
Err(error) => {

0 commit comments

Comments
 (0)