http: Update env vars for build process

Use the standard `SOURCE_DATE_EPOCH` instead of `GIT_COMMIT_TIME`.
Set `GIT_HEAD` properly.
This commit is contained in:
Sebastian Martinez
2024-06-20 20:52:24 +02:00
parent 730f7ae1fc
commit b68ea537b6
3 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -27,8 +27,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"pre-release".to_owned()
};
// Set a build-time `GIT_COMMIT_TIME` env var which includes the commit time.
let commit_time = env::var("GIT_COMMIT_TIME").unwrap_or_else(|_| {
// 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")
@@ -47,7 +47,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
});
println!("cargo::rustc-env=RADICLE_VERSION={version}");
println!("cargo::rustc-env=GIT_COMMIT_TIME={commit_time}");
println!("cargo::rustc-env=SOURCE_DATE_EPOCH={commit_time}");
println!("cargo::rustc-env=GIT_HEAD={hash}");
Ok(())
+1
View File
@@ -8,6 +8,7 @@ ARG TZ
ARG LC_ALL
ARG SOURCE_DATE_EPOCH
ARG RADICLE_VERSION
ARG GIT_HEAD
# Copy cargo configuration we're going to use to specify compiler options.
RUN mkdir -p .cargo && cp build/config.toml .cargo/config.toml
+1
View File
@@ -53,6 +53,7 @@ main() {
--build-arg TZ \
--build-arg LC_ALL \
--build-arg RADICLE_VERSION=$version \
--build-arg GIT_HEAD=$rev \
--arch aarch64 --tag $image -f ./build/Dockerfile - <$gitarchive
echo "Creating container (radicle-build-container).."