Skip to content
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

Use the commit date for build metadata #3322

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 2 additions & 1 deletion build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export OUT_DIR="${1-dist}"
export VERSION=${2:-$(git describe --tags --always --dirty)}

# To overwrite the version details, pass something as the third arg. Empty string disables it.
export VERSION_DETAILS=${3-"$(date -u +"%FT%T%z")/$(git describe --tags --always --long --dirty)"}
export COMMIT_DATE=$(git log -1 --format=%ct $VERSION | { read d ; date -u +"%FT%T%z" -d @"$d" ; })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export COMMIT_DATE=$(git log -1 --format=%ct $VERSION | { read d ; date -u +"%FT%T%z" -d @"$d" ; })
export COMMIT_DATE=$(git log -1 --format=%ct HEAD | { read d ; date -u +"%FT%T%z" -d @"$d" ; })

I feel like this is what you meant ?

You also can just drop HEAD I guess.

export VERSION_DETAILS=${3-"${COMMIT_DATE}/$(git describe --tags --always --long --dirty)"}
set +x

build() {
Expand Down