mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-12-02 19:40:35 +08:00
- Rename RADICLE_VERSION to RADICLE_HTTPD_VERSION, apart from heartwood's RADICLE_VERSION - Add Unreleased sections to the changelog and API changes log, so patches add their highlights as they land - Replace the release patch with a signed tag that one delegate pushes - Stop pushing the tag from upload: the delegate who makes the tag pushes it - Remove build/changelog - Add build/prepare to rename the Unreleased sections, in POSIX sh and awk - Ask a major release to set the target date to drop the previous major - Fix the signing key setup: use the bare key that build/tag compares against
55 lines
1.6 KiB
Rust
55 lines
1.6 KiB
Rust
use std::env;
|
|
use std::process::Command;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Set a build-time `GIT_HEAD` env var which includes the commit id;
|
|
// such that we can tell which code is running.
|
|
let hash = env::var("GIT_HEAD").unwrap_or_else(|_| {
|
|
Command::new("git")
|
|
.arg("rev-parse")
|
|
.arg("--short")
|
|
.arg("HEAD")
|
|
.output()
|
|
.ok()
|
|
.and_then(|output| {
|
|
if output.status.success() {
|
|
String::from_utf8(output.stdout).ok()
|
|
} else {
|
|
None
|
|
}
|
|
})
|
|
.unwrap_or("unknown".into())
|
|
});
|
|
|
|
let version = if let Ok(version) = env::var("RADICLE_HTTPD_VERSION") {
|
|
version
|
|
} else {
|
|
"pre-release".to_owned()
|
|
};
|
|
|
|
// Set a build-time `SOURCE_DATE_EPOCH` env var which includes the commit time.
|
|
let commit_time = env::var("SOURCE_DATE_EPOCH").unwrap_or_else(|_| {
|
|
Command::new("git")
|
|
.arg("log")
|
|
.arg("-1")
|
|
.arg("--pretty=%ct")
|
|
.arg("HEAD")
|
|
.output()
|
|
.ok()
|
|
.and_then(|output| {
|
|
if output.status.success() {
|
|
String::from_utf8(output.stdout).ok()
|
|
} else {
|
|
None
|
|
}
|
|
})
|
|
.unwrap_or(0.to_string())
|
|
});
|
|
|
|
println!("cargo::rustc-env=RADICLE_HTTPD_VERSION={version}");
|
|
println!("cargo::rustc-env=SOURCE_DATE_EPOCH={commit_time}");
|
|
println!("cargo::rustc-env=GIT_HEAD={hash}");
|
|
|
|
Ok(())
|
|
}
|