3578a39d27
Release / create-release (push) Failing after 31s
Release / build-linux-x86_64 (push) Has been skipped
Release / build-linux-aarch64 (push) Has been skipped
Release / build-macos (aarch64-apple-darwin) (push) Has been skipped
Release / build-macos (x86_64-apple-darwin) (push) Has been skipped
Release / build-windows (push) Has been skipped
- Fetch latest release from Gitea API using existing reqwest client - Match release asset by BUILD_TARGET triple (supports .tar.gz and .zip) - Compare versions; show confirmation prompt (skippable with -y/--yes) - Download archive, extract binary, atomically replace self via self-replace - Support private repositories via GITEA_TOKEN environment variable - Expose BUILD_TARGET in build.rs for compile-time target triple detection - Add .gitea/workflows/release.yml for multi-platform release builds on tag push Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
23 lines
752 B
Rust
23 lines
752 B
Rust
fn main() {
|
|
let output = std::process::Command::new("rustc")
|
|
.arg("--version")
|
|
.output()
|
|
.expect("Failed to run rustc --version");
|
|
let full = String::from_utf8(output.stdout).unwrap();
|
|
// "rustc 1.79.0 (129f3b996 2024-06-10)" → "1.79.0"
|
|
let version = full
|
|
.trim()
|
|
.trim_start_matches("rustc ")
|
|
.split_whitespace()
|
|
.next()
|
|
.unwrap_or("unknown")
|
|
.to_string();
|
|
println!("cargo:rustc-env=RUSTC_VERSION={}", version);
|
|
// Expose the build target triple so selfupdate can match release assets.
|
|
println!(
|
|
"cargo:rustc-env=BUILD_TARGET={}",
|
|
std::env::var("TARGET").unwrap_or_default()
|
|
);
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
}
|