From 047edf6a75133decf069e6118634caa76a455d7c Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 30 May 2023 17:09:07 -0400 Subject: ci: bump CI cache version on CLI version bump (#19318) Automatically bump the CI cache version --- tools/release/01_bump_crate_versions.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tools') diff --git a/tools/release/01_bump_crate_versions.ts b/tools/release/01_bump_crate_versions.ts index d9c67a817..c709ccc80 100755 --- a/tools/release/01_bump_crate_versions.ts +++ b/tools/release/01_bump_crate_versions.ts @@ -8,6 +8,8 @@ const repo = workspace.repo; const cliCrate = workspace.getCliCrate(); const originalCliVersion = cliCrate.version; +await bumpCiCacheVersion(); + // increment the cli version if (Deno.args.some((a) => a === "--patch")) { await cliCrate.increment("patch"); @@ -110,3 +112,25 @@ async function updateStdVersion() { text.replace(versionRe, `std@${newStdVersion}`), ); } + +async function bumpCiCacheVersion() { + const generateScript = workspace.repo.folderPath.join( + ".github/workflows/ci.generate.ts", + ); + const fileText = generateScript.readTextSync(); + const cacheVersionRegex = /const cacheVersion = ([0-9]+);/; + const version = fileText.match(cacheVersionRegex)?.[1]; + if (version == null) { + throw new Error("Could not find cache version in text."); + } + const toVersion = parseInt(version, 10) + 1; + $.logStep(`Bumping cache version from ${version} to ${toVersion}...`); + const newText = fileText.replace( + cacheVersionRegex, + `const cacheVersion = ${toVersion};`, + ); + generateScript.writeTextSync(newText); + + // run the script + await $`${generateScript}`; +} -- cgit v1.2.3