@@ -27,6 +27,7 @@ set -euo pipefail
2727# # that reference other packs in this repository (e.g., ^X.Y.Z constraints).
2828# # - qlt.conf.json (CodeQLCLI, CodeQLStandardLibrary, CodeQLCLIBundle)
2929# # using the base version (X.Y.Z) derived by stripping any pre-release suffix.
30+ # # - .codeql-version (vX.Y.Z, kept in sync with qlt.conf.json CodeQLCLI)
3031# #
3132# # Usage:
3233# # ./scripts/update-release-version.sh <new-version>
@@ -182,8 +183,24 @@ check_versions() {
182183 fi
183184 fi
184185
186+ # # Also check .codeql-version consistency (must match qlt.conf.json CodeQLCLI with v prefix)
187+ local codeql_version_file=" ${REPO_ROOT} /.codeql-version"
188+ if [[ -f " ${codeql_version_file} " ]]; then
189+ local codeql_file_version
190+ codeql_file_version=$( tr -d ' [:space:]' < " ${codeql_version_file} " )
191+ local check_base=" ${expected_version:- ${first_version} } "
192+ check_base=" ${check_base%% -* } "
193+ local expected_codeql_version=" v${check_base} "
194+ if [[ " ${codeql_file_version} " == " ${expected_codeql_version} " ]]; then
195+ echo " ✅ .codeql-version: ${codeql_file_version} "
196+ else
197+ echo " ❌ .codeql-version: ${codeql_file_version} (expected ${expected_codeql_version} )"
198+ all_consistent=false
199+ fi
200+ fi
201+
185202 echo " "
186- echo " Checked ${file_count} version-bearing files + qlt.conf.json."
203+ echo " Checked ${file_count} version-bearing files + qlt.conf.json + .codeql-version ."
187204
188205 if [[ " ${all_consistent} " == true ]]; then
189206 if [[ -n " ${expected_version} " ]]; then
@@ -257,6 +274,30 @@ update_qlt_config() {
257274 echo " ✅ qlt.conf.json: CodeQLCLI -> ${base_version} "
258275}
259276
277+ # # Update .codeql-version file (kept in sync with qlt.conf.json CodeQLCLI)
278+ # # The file contains the version with a 'v' prefix, e.g. v2.25.0
279+ update_codeql_version_file () {
280+ local new_version=" $1 "
281+ local dry_run=" ${2:- false} "
282+ local codeql_version_file=" ${REPO_ROOT} /.codeql-version"
283+
284+ # Derive the base version by stripping any pre-release suffix
285+ local base_version=" ${new_version%% -* } "
286+
287+ if [[ ! -f " ${codeql_version_file} " ]]; then
288+ echo " WARNING: .codeql-version not found, skipping" >&2
289+ return 0
290+ fi
291+
292+ if [[ " ${dry_run} " == true ]]; then
293+ echo " [DRY RUN] .codeql-version: -> v${base_version} "
294+ return 0
295+ fi
296+
297+ printf ' v%s\n' " ${base_version} " > " ${codeql_version_file} "
298+ echo " ✅ .codeql-version: -> v${base_version} "
299+ }
300+
260301# # Update internal dependency references in a qlpack.yml file
261302# # e.g., advanced-security/javascript-sap-cap-models: "^2.3.0" -> "^2.4.0"
262303# # e.g., advanced-security/javascript-sap-cap-models: "^2.3.0" -> "^2.4.0-alpha"
@@ -327,14 +368,15 @@ update_versions() {
327368 fi
328369 done
329370
330- # # Update qlt.conf.json
371+ # # Update qlt.conf.json and .codeql-version
331372 update_qlt_config " ${new_version} " " ${dry_run} "
373+ update_codeql_version_file " ${new_version} " " ${dry_run} "
332374
333375 echo " "
334376 if [[ " ${dry_run} " == true ]]; then
335- echo " Would update ${updated_count} qlpack files + qlt.conf.json. (Dry run — no files modified)"
377+ echo " Would update ${updated_count} qlpack files + qlt.conf.json + .codeql-version . (Dry run — no files modified)"
336378 else
337- echo " Updated ${updated_count} qlpack files + qlt.conf.json to version ${new_version} ."
379+ echo " Updated ${updated_count} qlpack files + qlt.conf.json + .codeql-version to version ${new_version} ."
338380 echo " "
339381 echo " Next steps:"
340382 echo " 1. Run 'codeql pack upgrade' on all packs to update lock files"
0 commit comments