Skip to content

Commit b3a2170

Browse files
committed
Account for prereleases in the logic that distinguishes between releases and nightlies
1 parent 6b422cf commit b3a2170

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

.circleci/config.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,7 @@ commands:
186186
steps:
187187
- run:
188188
name: Store prerelease suffix
189-
command: |
190-
if [[ -n "$CIRCLE_TAG" || -n "$FORCE_RELEASE" ]]; then
191-
echo -n > prerelease.txt
192-
else
193-
# Use last commit date rather than build date to avoid ending up with builds for
194-
# different platforms having different version strings (and therefore producing different bytecode)
195-
# if the CI is triggered just before midnight.
196-
TZ=UTC git show --quiet --date="format-local:%Y.%-m.%-d" --format="nightly.%cd" > prerelease.txt
197-
fi
189+
command: "scripts/prerelease_suffix.sh" nightly "$CIRCLE_TAG" > prerelease.txt
198190

199191
install_and_check_minimum_requirements:
200192
parameters:

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ else
1010
BUILD_TYPE="$1"
1111
fi
1212

13-
if [[ $(git tag --points-at HEAD 2> /dev/null) == v* ]]; then
13+
if [[ $(git tag --points-at HEAD 2> /dev/null) =~ ^v[0-9.]+$ ]]; then
1414
echo -n > prerelease.txt
1515
fi
1616

scripts/ci/build.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@ prerelease_source="${1:-ci}"
99

1010
cd "${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

2114
mkdir -p build
2215
cd build

scripts/ci/build_emscripten.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff 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)"
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.

scripts/prerelease_suffix.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
if [[ $FORCE_RELEASE != "" || $git_tag =~ ^v[0-9.]+$ ]]; then
10+
echo -n
11+
elif [[ $git_tag =~ ^v[0-9.]+-pre. ]]; then
12+
echo -n "pre.${git_tag#*-pre.}"
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+
TZ=UTC git show --quiet --date="format-local:%Y.%-m.%-d" --format="${prerelease_source}.%cd"
18+
fi

0 commit comments

Comments
 (0)