Skip to content

Commit 875a154

Browse files
committed
fixup! Unify the prerelease suffix logic across all scripts and CI
1 parent 7bff85e commit 875a154

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/prerelease_suffix.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ prerelease_source="${1:-nightly}"
66
git_tag="${2:-}"
77
FORCE_RELEASE="${FORCE_RELEASE:-}"
88

9+
GNU_DATE="date"
10+
if [[ "$OSTYPE" == "darwin"* ]]; then
11+
GNU_DATE=gdate
12+
fi
13+
914
if [[ $FORCE_RELEASE != "" || $git_tag =~ ^v[0-9.]+$ ]]; then
1015
echo -n
1116
elif [[ $git_tag =~ ^v[0-9.]+-pre. ]]; then
@@ -19,6 +24,6 @@ else
1924
# NOTE: git --date is supposed to support the %-m/%-d format too, but it does not seem to
2025
# work on Windows. Without it we get leading zeros for month and day.
2126
last_commit_date=$(TZ=UTC git show --quiet --date="format-local:%Y-%m-%d" --format="%cd")
22-
last_commit_date_stripped=$(date --date="$last_commit_date" "+%Y.%-m.%-d")
27+
last_commit_date_stripped=$("$GNU_DATE" --date "$last_commit_date" "+%Y.%-m.%-d")
2328
echo -n "${prerelease_source}.${last_commit_date_stripped}"
2429
fi

0 commit comments

Comments
 (0)