File tree Expand file tree Collapse file tree 6 files changed +35
-37
lines changed Expand file tree Collapse file tree 6 files changed +35
-37
lines changed Original file line number Diff line number Diff line change @@ -187,11 +187,7 @@ commands:
187187 - run :
188188 name : Store prerelease suffix
189189 command : |
190- if [[ -n $CIRCLE_TAG ]]; then
191- echo -n > prerelease.txt;
192- else
193- date -u +"nightly.%Y.%-m.%-d" > prerelease.txt;
194- fi
190+ "scripts/prerelease_suffix.sh" nightly "$CIRCLE_TAG" > prerelease.txt
195191
196192 install_and_check_minimum_requirements :
197193 parameters :
Original file line number Diff line number Diff line change 1010 BUILD_TYPE=" $1 "
1111fi
1212
13- if [[ $( git tag --points-at HEAD 2> /dev/null) == v* ]]; then
14- touch " ${ROOTDIR} /prerelease.txt"
13+ # Intentionally not using prerelease_suffix.sh here. We do not want lingering prerelease.txt in
14+ # dev builds, accidentally overriding version when someone runs the build manually.
15+ if [[ $( git tag --points-at HEAD 2> /dev/null) =~ ^v[0-9.]+$ ]]; then
16+ echo -n > prerelease.txt
1517fi
1618
1719mkdir -p " $BUILDDIR "
Original file line number Diff line number Diff line change @@ -9,14 +9,7 @@ prerelease_source="${1:-ci}"
99
1010cd " ${ROOTDIR} "
1111
12- if [[ -n $CIRCLE_TAG || -n $FORCE_RELEASE ]]; then
13- echo -n > prerelease.txt
14- else
15- # Use last commit date rather than build date to avoid ending up with builds for
16- # different platforms having different version strings (and therefore producing different bytecode)
17- # if the CI is triggered just before midnight.
18- TZ=UTC git show --quiet --date=" format-local:%Y.%-m.%-d" --format=" ${prerelease_source} .%cd" > prerelease.txt
19- fi
12+ " ${ROOTDIR} /scripts/prerelease_suffix.sh" " $prerelease_source " " $CIRCLE_TAG " > prerelease.txt
2013
2114mkdir -p build
2215cd build
Original file line number Diff line number Diff line change @@ -45,14 +45,7 @@ function build() {
4545
4646 cd " ${ROOT_DIR} "
4747
48- if [[ -n $CIRCLE_TAG || -n $FORCE_RELEASE || $( git tag --points-at HEAD 2> /dev/null) == v* ]]; then
49- echo -n > prerelease.txt
50- else
51- # Use last commit date rather than build date to avoid ending up with builds for
52- # different platforms having different version strings (and therefore producing different bytecode)
53- # if the CI is triggered just before midnight.
54- TZ=UTC git show --quiet --date=" format-local:%Y.%-m.%-d" --format=" ${prerelease_source} .%cd" > prerelease.txt
55- fi
48+ " ${SCRIPT_DIR} /prerelease_suffix.sh" " $prerelease_source " " $( git tag --points-at HEAD 2> /dev/null) " > prerelease.txt
5649
5750 # Disable warnings for unqualified `move()` calls, introduced and enabled by
5851 # default in clang-16 which is what the emscripten docker image uses.
Original file line number Diff line number Diff line change @@ -8,20 +8,7 @@ FORCE_RELEASE="${FORCE_RELEASE:-}"
88CIRCLE_TAG=" ${CIRCLE_TAG:- } "
99
1010cd " $ROOTDIR "
11- if [[ $FORCE_RELEASE != " " || $CIRCLE_TAG != " " ]]; then
12- echo -n > prerelease.txt
13- else
14- # Use last commit date rather than build date to avoid ending up with builds for
15- # different platforms having different version strings (and therefore producing different bytecode)
16- # if the CI is triggered just before midnight.
17- # NOTE: The -local suffix makes git not use the timezone from the commit but instead convert to
18- # local one, which we explicitly set to UTC.
19- # NOTE: git --date is supposed to support the %-m/%-d format too, but it does not seem to
20- # work on Windows. Without it we get leading zeros for month and day.
21- 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" )
23- echo -n " ${prerelease_source} .${last_commit_date_stripped} " > prerelease.txt
24- fi
11+ " ${ROOTDIR} /scripts/prerelease_suffix.sh" " $prerelease_source " " $CIRCLE_TAG " > prerelease.txt
2512
2613mkdir build/
2714cd build/
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ (( $# <= 2 )) || { >&2 echo " Usage: $0 [PRERELEASE_SOURCE] [GIT_TAG]" ; exit 1; }
5+ prerelease_source=" ${1:- nightly} "
6+ git_tag=" ${2:- } "
7+ FORCE_RELEASE=" ${FORCE_RELEASE:- } "
8+
9+ GNU_DATE=" date"
10+ if [[ " $OSTYPE " == " darwin" * ]]; then
11+ GNU_DATE=gdate
12+ fi
13+
14+ if [[ $FORCE_RELEASE != " " || $git_tag == v* ]]; then
15+ echo -n
16+ else
17+ # Use last commit date rather than build date to avoid ending up with builds for
18+ # different platforms having different version strings (and therefore producing different bytecode)
19+ # if the CI is triggered just before midnight.
20+ # NOTE: The -local suffix makes git not use the timezone from the commit but instead convert to
21+ # local one, which we explicitly set to UTC.
22+ # NOTE: git --date is supposed to support the %-m/%-d format too, but it does not seem to
23+ # work on Windows. Without it we get leading zeros for month and day.
24+ last_commit_date=$( TZ=UTC git show --quiet --date=" format-local:%Y-%m-%d" --format=" %cd" )
25+ last_commit_date_stripped=$( " $GNU_DATE " --date " $last_commit_date " " +%Y.%-m.%-d" )
26+ echo -n " ${prerelease_source} .${last_commit_date_stripped} "
27+ fi
You can’t perform that action at this time.
0 commit comments