mirror of
https://github.com/actionbook/actionbook.git
synced 2026-09-19 03:28:06 +08:00
58545129de
- Delete packages/actionbook-rs/ (legacy 0.x CLI) - Delete old packages/cli/ (JS npm wrapper for 0.x) - Rename packages/cli-v2/ → packages/cli/ (git mv) - Merge npm wrapper files (bin/actionbook.js, scripts/postinstall.js) into new cli/ - Update package.json: name → @actionbookdev/cli, private → false, add npm distribution fields - Update sync-versions.js: point Cargo.toml/Cargo.lock sync at packages/cli/ - Update release.yml: build from packages/cli/ instead of packages/actionbook-rs/ - Update test.yml: paths and working-directory from cli-v2 → cli - Update CLAUDE.md, CONTRIBUTING.md, docs, issue templates - Delete stale changeset (fix-screenshot-timeout.md) - Keep 6 platform binary packages unchanged
34 lines
1.0 KiB
Rust
34 lines
1.0 KiB
Rust
fn main() {
|
|
let hash = std::process::Command::new("git")
|
|
.args(["rev-parse", "--short", "HEAD"])
|
|
.output()
|
|
.ok()
|
|
.and_then(|o| String::from_utf8(o.stdout).ok())
|
|
.unwrap_or_default()
|
|
.trim()
|
|
.to_string();
|
|
|
|
let pkg_version = std::env::var("CARGO_PKG_VERSION").unwrap_or_default();
|
|
let build_version = if hash.is_empty() {
|
|
pkg_version
|
|
} else {
|
|
format!("{pkg_version}-{hash}")
|
|
};
|
|
|
|
println!("cargo:rustc-env=BUILD_VERSION={build_version}");
|
|
|
|
// Resolve repo root .git/HEAD for monorepo — relative paths are resolved
|
|
// from the package directory (packages/cli/), not the repo root.
|
|
let git_dir = std::process::Command::new("git")
|
|
.args(["rev-parse", "--git-dir"])
|
|
.output()
|
|
.ok()
|
|
.and_then(|o| String::from_utf8(o.stdout).ok())
|
|
.unwrap_or_default()
|
|
.trim()
|
|
.to_string();
|
|
if !git_dir.is_empty() {
|
|
println!("cargo:rerun-if-changed={git_dir}/HEAD");
|
|
}
|
|
}
|