Skip to content

Allow to override build date with SOURCE_DATE_EPOCH #2202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* respect configuration for remote when fetching (also applies to pulling) [[@cruessler](https://github.com/cruessler)] ([#1093](https://github.com/extrawurst/gitui/issues/1093))
* add `:` character to sign-off trailer to comply with Conventinoal Commits standard [@semioticrobotic](https://github.com/semioticrobotic) ([#2196](https://github.com/extrawurst/gitui/issues/2196))

### Added
* support overriding `build_date` for [reproducible builds](https://reproducible-builds.org/) [[@bmwiedemann](https://github.com/bmwiedemann)] ([#2202](https://github.com/extrawurst/gitui/pull/2202))

## [0.26.0+1] - 2024-04-14

**0.26.1**
**0.26.1**
this release has no changes to `0.26.0` but provides windows binaries that were missing before.

**commit signing**
Expand Down
10 changes: 9 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use chrono::TimeZone;

fn get_git_hash() -> String {
use std::process::Command;

Expand All @@ -18,7 +20,13 @@ fn get_git_hash() -> String {
}

fn main() {
let build_date = chrono::Local::now().date_naive();
let now = match std::env::var("SOURCE_DATE_EPOCH") {
Ok(val) => chrono::Local
.timestamp_opt(val.parse::<i64>().unwrap(), 0)
.unwrap(),
Err(_) => chrono::Local::now(),
};
let build_date = now.date_naive();

let build_name = if std::env::var("GITUI_RELEASE").is_ok() {
format!(
Expand Down