Skip to content

Commit 021ff0c

Browse files
authored
Merge pull request #11 from levelcodeai/fix/stamp-release-commit
build(macos): stamp product.json commit with the LevelCode release sha
2 parents 68e38e9 + 8a3130e commit 021ff0c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎scripts/build-macos.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ if [ -n "$ESBUILD_PKGS" ] && ! echo "$ESBUILD_PKGS" | grep -q "darwin-${EXPECT_N
5353
exit 1
5454
fi
5555

56+
# Stamp the shipped product.json with the LevelCode *release* commit, not the Code-OSS clone's.
57+
# gulp's getVersion() prefers $BUILD_SOURCEVERSION when it's a full 40-hex sha; otherwise it falls back
58+
# to vscode/.git HEAD — the pinned upstream Code-OSS commit, which is IDENTICAL for every LevelCode build
59+
# from tag $VSCODE_TAG. A shared commit across releases breaks the self-update up-to-date check
60+
# (GET /api/update/:target/:quality/:commit compares this exact value), so the app can never tell one
61+
# LevelCode release from the next. Use the LevelCode repo HEAD → each release reports a distinct commit;
62+
# set the same sha as the release's `commit` in the thin.ly update feed (LEVELCODE_UPDATE_FEED).
63+
if LC_COMMIT="$(git -C "$ROOT_DIR" rev-parse HEAD 2>/dev/null)" && [ "${#LC_COMMIT}" -eq 40 ]; then
64+
export BUILD_SOURCEVERSION="$LC_COMMIT"
65+
echo "[build] Stamping product.json commit = $LC_COMMIT (LevelCode repo HEAD)."
66+
else
67+
echo "[build] WARN: could not resolve a 40-char LevelCode repo commit — product.json will fall back to"
68+
echo "[build] the Code-OSS clone commit, which is shared across releases (breaks self-update)."
69+
fi
70+
5671
echo "[build] Compiling production build for $ARCH …"
5772
npm run gulp -- "$GULP_TARGET"
5873

0 commit comments

Comments
 (0)