From c3416c6c26ecaa3122a16355250b23fbcf7af6df Mon Sep 17 00:00:00 2001 From: Kenneth Hough Date: Mon, 22 Jun 2026 21:58:07 -0500 Subject: [PATCH] build: keep runtime VERSION literal in sync with the release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2.1.0 shipped logging "Initialized KyteJS v2.0.2" because the static VERSION literal in kyte-source.js was never bumped — release-please updated package.json + the manifest but not the JS literal, and the deploy builds straight from source. Three layers so it can't drift again: 1. x-release-please-version annotation on the VERSION line + extra-files in release-please-config.json -> release-please bumps the literal in the release PR, keeping committed source correct. 2. deploy.yml force-stamps the literal from the git tag at build time (single source of truth = tag, same as the copyright header) and fails the build if the stamp didn't take. 3. Bumped the current literal to 2.1.0 to match the live release. The shipped CDN bundle now always reports the tag version. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/deploy.yml | 14 ++++++++++++++ kyte-source.js | 7 +++++-- release-please-config.json | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 53e4509..546bc83 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -58,6 +58,20 @@ jobs: VERSION="${{ steps.version.outputs.VERSION }}" YEAR=$(date +'%Y') + # Force the runtime VERSION literal to the tag. Single source of + # truth is the git tag (same as the copyright header below). + # release-please's x-release-please-version annotation keeps the + # committed source in sync; this is the belt-and-suspenders so the + # SHIPPED bundle can never drift from the tag even if that slips + # (which is exactly how v2.1.0 went out logging "2.0.2"). + sed -i -E "s/(static VERSION *= *['\"])[0-9]+\.[0-9]+\.[0-9]+(['\"])/\1${VERSION}\2/" kyte-source.js + STAMPED=$(grep -oE "static VERSION *= *['\"][0-9.]+['\"]" kyte-source.js) + echo "Stamped: ${STAMPED}" + if ! echo "${STAMPED}" | grep -q "'${VERSION}'"; then + echo "::error::Failed to stamp VERSION literal to ${VERSION} (got: ${STAMPED})." + exit 1 + fi + # Two builds: # kyte.js — minified, with `//# sourceMappingURL=kyte.js.map` # appended by terser; pairs with kyte.js.map for diff --git a/kyte-source.js b/kyte-source.js index ea524e0..0af6579 100644 --- a/kyte-source.js +++ b/kyte-source.js @@ -16,8 +16,11 @@ * ©2020-2023 KeyQ, Inc. **/ class Kyte { - /** KyteJS Version # */ - static VERSION = '2.0.2'; + /** KyteJS Version # — kept in sync with the release by release-please + * (x-release-please-version annotation; see release-please-config.json + * extra-files). The deploy workflow also force-stamps this from the git + * tag at build time as a belt-and-suspenders. */ + static VERSION = '2.1.0'; // x-release-please-version /** **************** */ /** diff --git a/release-please-config.json b/release-please-config.json index da9af57..e0ddc32 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -7,6 +7,9 @@ "package-name": "kyte-api-js", "include-component-in-tag": false, "include-v-in-tag": true, + "extra-files": [ + { "type": "generic", "path": "kyte-source.js" } + ], "changelog-sections": [ { "type": "feat", "section": "Features" }, { "type": "fix", "section": "Bug Fixes" },