File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,6 @@ staticVersion="$VERSION"
15
15
if [[ " $VERSION " == * -dev ]]; then
16
16
export TZ=UTC
17
17
18
- DATE_COMMAND=" date"
19
- if [[ $( uname) == " Darwin" ]]; then
20
- DATE_COMMAND=" docker run --rm alpine date"
21
- fi
22
-
23
18
# based on golang's pseudo-version: https://groups.google.com/forum/#!topic/golang-dev/a5PqQuBljF4
24
19
#
25
20
# using a "pseudo-version" of the form v0.0.0-yyyymmddhhmmss-abcdefabcdef,
@@ -30,7 +25,16 @@ if [[ "$VERSION" == *-dev ]]; then
30
25
# as a pre-release before version v0.0.0, so that the go command prefers any
31
26
# tagged release over any pseudo-version.
32
27
gitUnix=" $( $GIT_COMMAND log -1 --pretty=' %ct' ) "
33
- gitDate=" $( $DATE_COMMAND --utc --date " @$gitUnix " +' %Y%m%d%H%M%S' ) "
28
+
29
+ if [ " $( uname) " = " Darwin" ]; then
30
+ # Using BSD date (macOS), which doesn't suppoort the --date option
31
+ # date -jf "<input format>" "<input value>" +"<output format>" (https://unix.stackexchange.com/a/86510)
32
+ gitDate=" $( TZ=UTC date -jf " %s" " $gitUnix " +' %Y%m%d%H%M%S' ) "
33
+ else
34
+ # Using GNU date (Linux)
35
+ gitDate=" $( TZ=UTC date --utc --date " @$gitUnix " +' %Y%m%d%H%M%S' ) "
36
+ fi
37
+
34
38
gitCommit=" $( $GIT_COMMAND log -1 --pretty=' %h' ) "
35
39
# generated version is now something like '0.0.0-20180719213702-cd5e2db'
36
40
staticVersion=" 0.0.0-${gitDate} -${gitCommit} "
You can’t perform that action at this time.
0 commit comments