mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
fix(versioning): embed version via rustc-env; drop OUT_DIR include
- Make version part of rustc inputs (sccache-friendly) to prevent stale 0.2.59 binaries appearing in newer releases. - Stop generating code_version.rs and include!(OUT_DIR/…). - CI: broaden release workflow paths-ignore to all workflows. - Docs: adjust changelog header + tip block. - Issue template: update example model list.
This commit is contained in:
@@ -24,7 +24,7 @@ body:
|
||||
id: model
|
||||
attributes:
|
||||
label: Which model were you using?
|
||||
description: Like `gpt-4.1`, `o4-mini`, `o3`, etc.
|
||||
description: Like `gpt-5`, `o3`, etc.
|
||||
- type: input
|
||||
id: platform
|
||||
attributes:
|
||||
|
||||
@@ -4,14 +4,13 @@ on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- '.github/workflows/test.yml'
|
||||
- '.github/workflows/**'
|
||||
- 'examples/**'
|
||||
- '**/*.test.ts'
|
||||
- 'test/**'
|
||||
- '*.md'
|
||||
- 'CHANGELOG.md'
|
||||
- 'release-notes/**'
|
||||
- '.github/workflows/release.yml'
|
||||
- 'codex-cli/package.json'
|
||||
|
||||
concurrency:
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
Changelog
|
||||
# Changelog
|
||||
|
||||
All notable changes to Code are documented here.
|
||||
> [!TIP]
|
||||
> We're constantly improving Code! This page documents the core changes. You can also check our [releases page](https://github.com/just-every/code/releases) for additional information.
|
||||
|
||||
## [0.2.61] - 2025-09-05
|
||||
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Prefer an explicit CODE_VERSION provided by CI; fall back to the
|
||||
// crate's package version to keep local builds sane.
|
||||
let version = env::var("CODE_VERSION").unwrap_or_else(|_| env!("CARGO_PKG_VERSION").to_string());
|
||||
let version = std::env::var("CODE_VERSION")
|
||||
.unwrap_or_else(|_| env!("CARGO_PKG_VERSION").to_string());
|
||||
|
||||
// Emit a small Rust source file that bakes the version into the crate's
|
||||
// compiled inputs so that cache systems like sccache invalidate when the
|
||||
// version changes.
|
||||
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is set by Cargo"));
|
||||
let dst = out_dir.join("code_version.rs");
|
||||
|
||||
// Use inlined formatting to avoid warnings per repo policy.
|
||||
let contents = format!("pub const CODE_VERSION: &str = \"{}\";\n", version);
|
||||
fs::write(&dst, contents).expect("write code_version.rs");
|
||||
// Inject the version as a rustc env so it participates in the compiler
|
||||
// invocation hash (sccache-friendly) and guarantees a cache miss when
|
||||
// the version changes.
|
||||
println!("cargo:rustc-env=CODE_VERSION={}", version);
|
||||
|
||||
// Ensure dependent crates rebuild when CODE_VERSION changes even if the
|
||||
// source graph stays the same.
|
||||
println!("cargo:rerun-if-env-changed=CODE_VERSION");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
// Generated at build time via build.rs; contains:
|
||||
// pub const CODE_VERSION: &str = "x.y.z";
|
||||
include!(concat!(env!("OUT_DIR"), "/code_version.rs"));
|
||||
// Compile-time embedded version string.
|
||||
// Prefer the CODE_VERSION provided by CI; fall back to the package
|
||||
// version for local builds.
|
||||
pub const CODE_VERSION: &str = {
|
||||
match option_env!("CODE_VERSION") {
|
||||
Some(v) => v,
|
||||
None => env!("CARGO_PKG_VERSION"),
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
pub fn version() -> &'static str {
|
||||
CODE_VERSION
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user