From 64553d61556e24425a1d53e4005550593e2f61d7 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 10:04:11 +0000 Subject: [PATCH 01/27] Start work for issue #254 From 4abff92e6121c9e7ab17f27bca6d3f183d9a6a8a Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 10:04:54 +0000 Subject: [PATCH 02/27] cleanup: remove unused script --- .github/internal-cicd/deno-tasks/clear-screen.ts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/internal-cicd/deno-tasks/clear-screen.ts diff --git a/.github/internal-cicd/deno-tasks/clear-screen.ts b/.github/internal-cicd/deno-tasks/clear-screen.ts deleted file mode 100644 index ac220cff..00000000 --- a/.github/internal-cicd/deno-tasks/clear-screen.ts +++ /dev/null @@ -1 +0,0 @@ -console.clear(); From a159bffaea4535453a3db2cc30960559c8a5ee88 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 10:27:36 +0000 Subject: [PATCH 03/27] ci: create script to update repo variable --- .../scripts/update-cicd-script-version.ts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/internal-cicd/scripts/update-cicd-script-version.ts diff --git a/.github/internal-cicd/scripts/update-cicd-script-version.ts b/.github/internal-cicd/scripts/update-cicd-script-version.ts new file mode 100644 index 00000000..b87f16e2 --- /dev/null +++ b/.github/internal-cicd/scripts/update-cicd-script-version.ts @@ -0,0 +1,33 @@ +import { RepoClient } from "jsr:@kinsondigital/kd-clients@1.0.0-preview.14"; +import getEnvVar from "../../../cicd/core/GetEnvVar.ts"; +import { Utils } from "../../../cicd/core/Utils.ts"; + +const scriptFileName = new URL(import.meta.url).pathname.split("/").pop(); +const ownerName = getEnvVar("OWNER_NAME", scriptFileName); +const repoName = getEnvVar("REPO_NAME", scriptFileName); +const token = getEnvVar("GITHUB_TOKEN", scriptFileName); +const cicdScriptVersionRepoVarName = getEnvVar("CICD_SCRIPTS_VERSION_REPO_VAR_NAME", scriptFileName); +const newVersion = getEnvVar("VERSION", scriptFileName); + +try { + const client = new RepoClient(ownerName, repoName, token); + const exists = await client.variableExists(cicdScriptVersionRepoVarName); + + if (!exists) { + console.error(`The repository variable '${cicdScriptVersionRepoVarName}' does not exist.`); + Deno.exit(1); + } + + await client.updateVariable(cicdScriptVersionRepoVarName, newVersion); + + Utils.printAsGitHubNotice(`Updated the repository variable '${cicdScriptVersionRepoVarName}' value to '${newVersion}'.`); +} catch (error) { + if (error instanceof Error) { + console.error(error.message); + } else { + console.error("An error occurred."); + console.error(error); + } + + Deno.exit(1); +} From eae6a22e7a7166800b216c61bcb7705635a680f8 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 10:28:02 +0000 Subject: [PATCH 04/27] ci: add step to release workflow to update cicd scripts repo variable --- .github/workflows/release.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff284d98..7900ebeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -275,3 +275,16 @@ jobs: } deno run -ERN "${{ steps.script-url.outputs.url }}/close-milestone.ts"; + + - name: Update CICD Script Version Repo Var ${{ inputs.dry-run == true && '(Dry Run)' || '' }} + env: + CICD_SCRIPTS_VERSION_REPO_VAR_NAME: "CICD_SCRIPTS_VERSION" + VERSION: "${{ needs.get_validate_version.outputs.version }}" + GITHUB_TOKEN: "${{ secrets.CICD_TOKEN }}" + run: | + if ("${{ inputs.dry-run == true }}" -eq "true") { + Write-Host "::notice::Updating 'CICD_SCRIPTS_VERSION' repository variable ..."; + exit 0; + } + + deno run -EN "${{ github.workspace }}/.github/internal-cicd/scripts/update-cicd-script-version.ts"; From a494b8ea04addbac73698c677962a02d7013439a Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 10:28:24 +0000 Subject: [PATCH 05/27] ide: create launch config for update-cicd-script-version.ts script --- .vscode/launch.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 19b9ecb0..f5050406 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -609,6 +609,32 @@ "linux": { "runtimeExecutable": "${userHome}/.deno/bin/deno" } + }, + { // UPDATE CICD SCRIPT VERSION + "name": "Update CICD Script Version", + "request": "launch", + "type": "node", + "program": "${workspaceFolder}/.github/internal-cicd/scripts/update-cicd-script-version.ts", + "cwd": "${workspaceFolder}", + "runtimeArgs": [ + "run", + "-EN", + "--inspect-wait", + ], + "env": { + "OWNER_NAME": "KinsonDigital", + "REPO_NAME": "Infrastructure", + "CICD_SCRIPTS_VERSION_REPO_VAR_NAME": "CICD_SCRIPTS_VERSION", + "VERSION": "v1.2.3", + "GITHUB_TOKEN": "${env:CICD_TOKEN}", + }, + "attachSimplePort": 9229, + "windows": { + "runtimeExecutable": "${userHome}/.deno/bin/deno.exe" + }, + "linux": { + "runtimeExecutable": "${userHome}/.deno/bin/deno" + } }, ] } From 419db55dd99af4abcf0b786f534cad73a2d4e134 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 10:28:33 +0000 Subject: [PATCH 06/27] deps: update deno lock --- deno.lock | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/deno.lock b/deno.lock index 867208e9..5ae05be8 100644 --- a/deno.lock +++ b/deno.lock @@ -1,12 +1,24 @@ { "version": "4", "specifiers": { + "jsr:@kinsondigital/kd-clients@1.0.0-preview.14": "1.0.0-preview.14", + "jsr:@nexterias/twitter-api-fetch@3.0.1": "3.0.1", + "jsr:@std/assert@0.224": "0.224.0", + "jsr:@std/assert@0.224.0": "0.224.0", + "jsr:@std/encoding@0.224.0": "0.224.0", + "jsr:@std/encoding@~0.219.1": "0.219.1", + "jsr:@std/fmt@0.224": "0.224.0", "jsr:@std/fs@*": "1.0.4", + "jsr:@std/fs@0.224.0": "0.224.0", "jsr:@std/fs@1.0.4": "1.0.4", "jsr:@std/fs@1.0.8": "1.0.8", "jsr:@std/fs@^1.0.4": "1.0.8", + "jsr:@std/internal@0.224": "0.224.0", + "jsr:@std/path@0.224": "0.224.0", + "jsr:@std/path@0.224.0": "0.224.0", "jsr:@std/path@^1.0.6": "1.0.8", "jsr:@std/path@^1.0.8": "1.0.8", + "jsr:@std/testing@0.224.0": "0.224.0", "npm:@types/node@*": "18.16.19", "npm:chalk@4.1.1": "4.1.1", "npm:chalk@5.3.0": "5.3.0", @@ -14,6 +26,46 @@ "npm:twitter-api-v2@1.15.0": "1.15.0" }, "jsr": { + "@kinsondigital/kd-clients@1.0.0-preview.14": { + "integrity": "fd6f87a697715c9aecdf7c9f6e23e246f3929db9defb16f866c33fa784366e5f", + "dependencies": [ + "jsr:@nexterias/twitter-api-fetch", + "jsr:@std/assert@0.224.0", + "jsr:@std/encoding@0.224.0", + "jsr:@std/fs@0.224.0", + "jsr:@std/path@0.224.0", + "jsr:@std/testing" + ] + }, + "@nexterias/twitter-api-fetch@3.0.1": { + "integrity": "9fb5a6770ce659b46df02c3b93ed4ab13ce7b3dd9a84232e0bc921fe7bdd1dad", + "dependencies": [ + "jsr:@std/encoding@~0.219.1" + ] + }, + "@std/assert@0.224.0": { + "integrity": "8643233ec7aec38a940a8264a6e3eed9bfa44e7a71cc6b3c8874213ff401967f", + "dependencies": [ + "jsr:@std/fmt", + "jsr:@std/internal" + ] + }, + "@std/encoding@0.219.1": { + "integrity": "77b30e481a596cfb2a8f2f38c3165e6035a4f76a7259bf89b6a622ceaf57d575" + }, + "@std/encoding@0.224.0": { + "integrity": "efb6dca97d3e9c31392bd5c8cfd9f9fc9decf5a1f4d1f78af7900a493bcf89b5" + }, + "@std/fmt@0.224.0": { + "integrity": "e20e9a2312a8b5393272c26191c0a68eda8d2c4b08b046bad1673148f1d69851" + }, + "@std/fs@0.224.0": { + "integrity": "52a5ec89731ac0ca8f971079339286f88c571a4d61686acf75833f03a89d8e69", + "dependencies": [ + "jsr:@std/assert@0.224", + "jsr:@std/path@0.224" + ] + }, "@std/fs@1.0.4": { "integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c", "dependencies": [ @@ -26,11 +78,29 @@ "jsr:@std/path@^1.0.8" ] }, + "@std/internal@0.224.0": { + "integrity": "afc50644f9cdf4495eeb80523a8f6d27226b4b36c45c7c195dfccad4b8509291", + "dependencies": [ + "jsr:@std/fmt" + ] + }, + "@std/path@0.224.0": { + "integrity": "55bca6361e5a6d158b9380e82d4981d82d338ec587de02951e2b7c3a24910ee6", + "dependencies": [ + "jsr:@std/assert@0.224" + ] + }, "@std/path@1.0.6": { "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" }, "@std/path@1.0.8": { "integrity": "548fa456bb6a04d3c1a1e7477986b6cffbce95102d0bb447c67c4ee70e0364be" + }, + "@std/testing@0.224.0": { + "integrity": "371b8a929aa7132240d5dd766a439be8f780ef5c176ab194e0bcab72370c761e", + "dependencies": [ + "jsr:@std/assert@0.224" + ] } }, "npm": { From c13054661e1d99d476357be9cce48a0bfb27cb78 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:17:47 +0000 Subject: [PATCH 07/27] ci: convert vscode task script to cicd script --- .../scripts/update-workflow-versions.ts | 74 +++++++------------ 1 file changed, 27 insertions(+), 47 deletions(-) diff --git a/.github/internal-cicd/scripts/update-workflow-versions.ts b/.github/internal-cicd/scripts/update-workflow-versions.ts index 3b9c33c2..a9bd9bd1 100644 --- a/.github/internal-cicd/scripts/update-workflow-versions.ts +++ b/.github/internal-cicd/scripts/update-workflow-versions.ts @@ -1,55 +1,36 @@ -import { Directory, Input, RepoClient, TagClient } from "../../../deps.ts"; -import chalk from "../../../deps.ts"; -import { File } from "../../../cicd/core/File.ts"; -import { Utils } from "../../../cicd/core/Utils.ts"; +import { existsSync, walkSync } from "jsr:@std/fs@1.0.11"; +import { Input } from "jsr:@cliffy/prompt@1.0.0-rc.7"; +import { RepoClient, TagClient } from "jsr:@kinsondigital/kd-clients@1.0.0-preview.14"; import getEnvVar from "../../../cicd/core/GetEnvVar.ts"; const scriptFileName = new URL(import.meta.url).pathname.split("/").pop(); -let baseDirPath = getEnvVar("BASE_DIR_PATH", scriptFileName); +const ownerName = getEnvVar("OWNER_NAME", scriptFileName); +const repoName = getEnvVar("REPO_NAME", scriptFileName); +const baseDirPath = getEnvVar("BASE_DIR_PATH", scriptFileName); const token = getEnvVar("GITHUB_TOKEN", scriptFileName); +const newVersion = getEnvVar("NEW_VERSION", scriptFileName); -baseDirPath = Utils.normalizePath(baseDirPath.trim()); - -if (!Directory.Exists(baseDirPath)) { - console.log(chalk.red(`Directory '${baseDirPath}' does not exist.`)); +if (!existsSync(baseDirPath)) { + console.log(`%cDirectory '${baseDirPath}' does not exist.`, "color: red"); Deno.exit(0); } -// Clear the console so the token is not visible from the tasks.json file -console.clear(); - const tagRegex = /v([1-9]\d*|0)\.([1-9]\d*|0)\.([1-9]\d*|0)(-preview\.([1-9]\d*))?/gm; -const newVersion = await Input.prompt({ - message: chalk.blue("Enter version to upgrade workflows to:"), - hint: "Use a tag with the syntax 'v#.#.#'.", - minLength: 5, - validate: (value) => { - return tagRegex.test(value.trim().toLowerCase()); - }, - transform: (value) => { - value = value.trim().toLowerCase(); - - return value.startsWith("v") ? value : `v${value}`; - }, -}); - -const ownerName = "KinsonDigital"; -const repoName = "Infrastructure"; -const allFiles = Directory.getFiles(baseDirPath, true); - -const yamlFiles = allFiles.filter((file) => file.toLowerCase().endsWith(".yaml") || file.toLowerCase().endsWith(".yml")); -const tagClient: TagClient = new TagClient(ownerName, repoName, token); - -const allTags = (await tagClient.getAllTags()).map((t) => t.name); - -// If the new tag already exists, throw an error -if (allTags.includes(newVersion)) { - console.log(chalk.red(`Tag '${newVersion}' already exists.`)); +if (!tagRegex.test(newVersion)) { + console.log(`%cThe version '${newVersion}' is not a valid version number.`, "color: red"); Deno.exit(0); } + +const walkResult = walkSync(baseDirPath, { + includeDirs: false, + includeFiles: true, + exts: [".yml", ".yaml"], +}); + +const yamlFiles = Array.from(walkResult).map((e) => e.path); const reusableWorkflowRegex = /uses: .+.(yml|yaml)@v([1-9]\d*|0)\.([1-9]\d*|0)\.([1-9]\d*|0)(-preview\.([1-9]\d*))?/gm; const updateMsgs: string[] = []; @@ -57,7 +38,7 @@ let noFilesUpdated = true; // Search for workflow references with a version that has not been updated yamlFiles.forEach((yamlFile) => { - let fileContent = File.LoadFile(yamlFile); + let fileContent = Deno.readTextFileSync(yamlFile); const possibleUpdates = fileContent.match(reusableWorkflowRegex)?.map((w) => w) ?? []; @@ -86,25 +67,25 @@ yamlFiles.forEach((yamlFile) => { // If anything has been updated, save the file if (fileUpdated) { // Save the changes to the file - File.SaveFile(yamlFile, fileContent); + Deno.writeTextFileSync(yamlFile, fileContent); } }); // If no files were updated if (noFilesUpdated) { - console.log(chalk.cyan("No files needed updating.")); + console.log("%cNo files needed updating.", "color: cyan"); } else { updateMsgs.sort(); updateMsgs.forEach((updateMsg) => { - console.log(chalk.cyan(updateMsg)); + console.log(`%c${updateMsg}`, "color: cyan"); }); } const repoVarName = "CICD_SCRIPTS_VERSION"; const repoClient = new RepoClient(ownerName, repoName, token); -if (!(await repoClient.repoVariableExists(repoVarName))) { - console.log(chalk.red(`The repository variable '${repoVarName}' does not exist.`)); +if (!(await repoClient.variableExists(repoVarName))) { + console.log(`%cThe repository variable '${repoVarName}' does not exist.`, "color: red"); Deno.exit(0); } @@ -112,6 +93,5 @@ const scriptVersionVar = (await repoClient.getVariables()).find((v) => v.name == await repoClient.updateVariable(repoVarName, newVersion); -console.log( - chalk.cyan(`Updated repository variable '${repoVarName}' from version '${scriptVersionVar?.value}' to '${newVersion}'.`), -); +const msg = `%cUpdated repository variable '${repoVarName}' from version '${scriptVersionVar?.value}' to '${newVersion}'.`; +console.log(msg, "color: cyan"); From 1b41e92aa6d3ddb1770a93188559870b965ab062 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:18:19 +0000 Subject: [PATCH 08/27] ci: add step to update reusable workflow versions --- .github/workflows/release.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7900ebeb..778828ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -252,6 +252,28 @@ jobs: $releaseType = "${{ inputs.release-type }}".ToLower(); "release-type=$releaseType" > "$env:GITHUB_OUTPUT"; + - name: Update Reusable Workflow Versions ${{ inputs.dry-run == true && '(Dry Run)' || '' }} + env: + BASE_DIR_PATH: "${{ github.workspace }}/.github/workflows" + NEW_VERSION: "${{ needs.get_validate_version.outputs.version }}" + GITHUB_TOKEN: "${{ secrets.CICD_TOKEN }}" + run: | + if ("${{ inputs.dry-run == true }}" -eq "true") { + Write-Host "::notice::Updating 'CICD_SCRIPTS_VERSION' repository variable ..."; + exit 0; + } + + deno run -EN "${{ github.workspace }}/.github/internal-cicd/scripts/update-workflow-versions.ts"; + + $releaseType = "${{ inputs.release-type }}"; + + git config --global user.email "${{ vars.GIT_CONFIG_EMAIL }}"; + git config --global user.name "CICD Release Script - (On behalf of Calvin Wilkinson)"; + + git add -A; + git commit -m "🚀$releaseType (${{ needs.get_validate_version.outputs.version }}) - Update reusable workflow versions"; + git push; + - name: Create GitHub Release ${{ inputs.dry-run == true && '(Dry Run)' || '' }} if: ${{ inputs.dry-run == false }} uses: ncipollo/release-action@v1 @@ -286,5 +308,5 @@ jobs: Write-Host "::notice::Updating 'CICD_SCRIPTS_VERSION' repository variable ..."; exit 0; } - + deno run -EN "${{ github.workspace }}/.github/internal-cicd/scripts/update-cicd-script-version.ts"; From c182fe0fa0c326a76c6f8ea0e47743b518b59878 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:18:37 +0000 Subject: [PATCH 09/27] chore: remove unused exports --- deps.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/deps.ts b/deps.ts index 7039a5bd..5d588e38 100644 --- a/deps.ts +++ b/deps.ts @@ -30,9 +30,6 @@ import { UserModel, } from "https://deno.land/x/kd_clients@v1.0.0-preview.8/core/Models/mod.ts"; -// CLIFFY -import { Input } from "https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/input.ts"; - // NPM PACKAGES import chalk from "npm:chalk@5.3.0"; @@ -64,9 +61,6 @@ export { }; export type { GitHubVarModel, IssueModel, LabelModel, MilestoneModel, ProjectModel, PullRequestModel, UserModel }; -// CLIFFY -export { Input }; - // NPM PACKAGES export default chalk; From 514599f1d43aefce80733c896077f9407946255e Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:18:45 +0000 Subject: [PATCH 10/27] deps: update deno lock --- deno.lock | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/deno.lock b/deno.lock index 5ae05be8..a5f2ec6a 100644 --- a/deno.lock +++ b/deno.lock @@ -1,15 +1,23 @@ { "version": "4", "specifiers": { + "jsr:@cliffy/ansi@1.0.0-rc.7": "1.0.0-rc.7", + "jsr:@cliffy/internal@1.0.0-rc.7": "1.0.0-rc.7", + "jsr:@cliffy/keycode@1.0.0-rc.7": "1.0.0-rc.7", + "jsr:@cliffy/prompt@1.0.0-rc.7": "1.0.0-rc.7", "jsr:@kinsondigital/kd-clients@1.0.0-preview.14": "1.0.0-preview.14", "jsr:@nexterias/twitter-api-fetch@3.0.1": "3.0.1", "jsr:@std/assert@0.224": "0.224.0", "jsr:@std/assert@0.224.0": "0.224.0", + "jsr:@std/assert@~1.0.6": "1.0.11", "jsr:@std/encoding@0.224.0": "0.224.0", "jsr:@std/encoding@~0.219.1": "0.219.1", + "jsr:@std/encoding@~1.0.5": "1.0.7", "jsr:@std/fmt@0.224": "0.224.0", + "jsr:@std/fmt@~1.0.2": "1.0.5", "jsr:@std/fs@*": "1.0.4", "jsr:@std/fs@0.224.0": "0.224.0", + "jsr:@std/fs@1.0.11": "1.0.11", "jsr:@std/fs@1.0.4": "1.0.4", "jsr:@std/fs@1.0.8": "1.0.8", "jsr:@std/fs@^1.0.4": "1.0.8", @@ -18,7 +26,9 @@ "jsr:@std/path@0.224.0": "0.224.0", "jsr:@std/path@^1.0.6": "1.0.8", "jsr:@std/path@^1.0.8": "1.0.8", + "jsr:@std/path@~1.0.6": "1.0.8", "jsr:@std/testing@0.224.0": "0.224.0", + "jsr:@std/text@~1.0.7": "1.0.10", "npm:@types/node@*": "18.16.19", "npm:chalk@4.1.1": "4.1.1", "npm:chalk@5.3.0": "5.3.0", @@ -26,6 +36,31 @@ "npm:twitter-api-v2@1.15.0": "1.15.0" }, "jsr": { + "@cliffy/ansi@1.0.0-rc.7": { + "integrity": "f71c921cce224c13d322e5cedba4f38e8f7354c7d855c9cb22729362a53f25aa", + "dependencies": [ + "jsr:@cliffy/internal", + "jsr:@std/encoding@~1.0.5" + ] + }, + "@cliffy/internal@1.0.0-rc.7": { + "integrity": "10412636ab3e67517d448be9eaab1b70c88eba9be22617b5d146257a11cc9b17" + }, + "@cliffy/keycode@1.0.0-rc.7": { + "integrity": "5b3f6c33994e81a76b79f108b1989642ac22705840da33781f7972d7dff05503" + }, + "@cliffy/prompt@1.0.0-rc.7": { + "integrity": "a9cbd13acd8073558447cae8ca4cf593c09d23bcbe429cc63346920c21187b83", + "dependencies": [ + "jsr:@cliffy/ansi", + "jsr:@cliffy/internal", + "jsr:@cliffy/keycode", + "jsr:@std/assert@~1.0.6", + "jsr:@std/fmt@~1.0.2", + "jsr:@std/path@~1.0.6", + "jsr:@std/text" + ] + }, "@kinsondigital/kd-clients@1.0.0-preview.14": { "integrity": "fd6f87a697715c9aecdf7c9f6e23e246f3929db9defb16f866c33fa784366e5f", "dependencies": [ @@ -46,19 +81,28 @@ "@std/assert@0.224.0": { "integrity": "8643233ec7aec38a940a8264a6e3eed9bfa44e7a71cc6b3c8874213ff401967f", "dependencies": [ - "jsr:@std/fmt", + "jsr:@std/fmt@0.224", "jsr:@std/internal" ] }, + "@std/assert@1.0.11": { + "integrity": "2461ef3c368fe88bc60e186e7744a93112f16fd110022e113a0849e94d1c83c1" + }, "@std/encoding@0.219.1": { "integrity": "77b30e481a596cfb2a8f2f38c3165e6035a4f76a7259bf89b6a622ceaf57d575" }, "@std/encoding@0.224.0": { "integrity": "efb6dca97d3e9c31392bd5c8cfd9f9fc9decf5a1f4d1f78af7900a493bcf89b5" }, + "@std/encoding@1.0.7": { + "integrity": "f631247c1698fef289f2de9e2a33d571e46133b38d042905e3eac3715030a82d" + }, "@std/fmt@0.224.0": { "integrity": "e20e9a2312a8b5393272c26191c0a68eda8d2c4b08b046bad1673148f1d69851" }, + "@std/fmt@1.0.5": { + "integrity": "0cfab43364bc36650d83c425cd6d99910fc20c4576631149f0f987eddede1a4d" + }, "@std/fs@0.224.0": { "integrity": "52a5ec89731ac0ca8f971079339286f88c571a4d61686acf75833f03a89d8e69", "dependencies": [ @@ -78,10 +122,16 @@ "jsr:@std/path@^1.0.8" ] }, + "@std/fs@1.0.11": { + "integrity": "ba674672693340c5ebdd018b4fe1af46cb08741f42b4c538154e97d217b55bdd", + "dependencies": [ + "jsr:@std/path@^1.0.8" + ] + }, "@std/internal@0.224.0": { "integrity": "afc50644f9cdf4495eeb80523a8f6d27226b4b36c45c7c195dfccad4b8509291", "dependencies": [ - "jsr:@std/fmt" + "jsr:@std/fmt@0.224" ] }, "@std/path@0.224.0": { @@ -101,6 +151,9 @@ "dependencies": [ "jsr:@std/assert@0.224" ] + }, + "@std/text@1.0.10": { + "integrity": "9dcab377450253c0efa9a9a0c731040bfd4e1c03f8303b5934381467b7954338" } }, "npm": { From 761224580c80043313a5046e98ed471272456ffa Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:18:58 +0000 Subject: [PATCH 11/27] ide: remove task --- .vscode/tasks.json | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 230a30d9..5bf6a724 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -28,25 +28,5 @@ "${workspaceFolder}/.github/cicd", ] }, - { // UPDATE WORKFLOW VERSIONS - "label": "Update Workflow Versions", - "detail": "Updates all of the reusuable workflow versions.", - "type": "shell", - "dependsOn": ["clear-terminal"], - "windows": { - "command": "deno", - "options": { - "env": { - "BASE_DIR_PATH": "${workspaceFolder}/.github/workflows", - "GITHUB_TOKEN": "${env:CICD_TOKEN}", - } - }, - "args": [ - "run", - "-ERWNS", - "${workspaceFolder}/.github/internal-cicd/scripts/update-workflow-versions.ts", - ] - } - } ] } From 7656b1dd2634e86fd154aeda1e0af139ddb5dd96 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:19:11 +0000 Subject: [PATCH 12/27] ci: update launch config --- .vscode/launch.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index f5050406..465e84bc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -402,7 +402,10 @@ "--inspect-wait", ], "env": { + "OWNER_NAME": "KinsonDigital", + "REPO_NAME": "Infrastructure", "BASE_DIR_PATH": "${workspaceFolder}/.github/workflows", + "NEW_VERSION": "v1.2.3", "GITHUB_TOKEN": "${env:CICD_TOKEN}", }, "attachSimplePort": 9229, From e65f8c1d0342ba0f6cd1b5af17dfaea19ca69db1 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:19:42 +0000 Subject: [PATCH 13/27] ide: add word to dictionary --- .vscode/settings.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 33f885c9..d1722d17 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,10 +6,12 @@ "cSpell.words": [ "cicd", "Creds", + "denoland", "endgroup", "flatcontainer", "kdadmin", "Kinson", + "kinsondigital", "mediumseagreen", "ncipollo", "Nums", From 88fd965d1e3b86e6bf8cfe458a834d5847cb10e1 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:23:04 +0000 Subject: [PATCH 14/27] ci: remove branch check step --- .github/workflows/release.yml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 778828ce..f6fd28ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,15 +72,6 @@ jobs: "url=$scriptUrl" >> $env:GITHUB_OUTPUT; - - name: Branch Check - id: branch-check - continue-on-error: true - run: | - if ("${{ github.ref_name }}" -ne "main") { - Write-Host "::error::The branch '$branch' is invalid. Please only run on the 'main' branch."; - exit 1; - } - - name: Milestone Exists id: milestone-exists-check continue-on-error: true @@ -145,17 +136,12 @@ jobs: - name: Should Fail Job run: | - $branchCheckFailed = "${{ steps.branch-check.outcome == 'failure' }}"; $milestoneExistsCheckFailed = "${{ steps.milestone-exists-check.outcome == 'failure' }}"; $milestoneCheckFailed = "${{ steps.milestone-check.outcome == 'failure' }}"; $releaseNotesCheckFailed = "${{ steps.release-notes-check.outcome == 'failure' }}"; $githubReleaseCheckFailed = "${{ steps.github-release-check.outcome == 'failure' }}"; $workflowVersionsCheckCheckFailed = "${{ steps.workflow-versions-check.outcome == 'failure' }}"; - if ($branchCheckFailed -eq "true") { - Write-Host "::error::The branch is invalid. Check the 'run-branch' workflow input."; - } - if ($milestoneExistsCheckFailed -eq "true") { Write-Host "::error::The milestone '${{ needs.get_validate_version.outputs.version }}' does not exist."; } @@ -176,8 +162,7 @@ jobs: Write-Host "::error::The one or more reusable workflow versions haver not been updated."; } - if ($branchCheckFailed -eq "true" ` - -or $milestoneExistsCheckFailed -eq "true" ` + if ($milestoneExistsCheckFailed -eq "true" ` -or $milestoneCheckFailed -eq "true" ` -or $releaseNotesCheckFailed -eq "true" ` -or $githubReleaseCheckFailed -eq "true" ` From 35a757412a0a9c66cab9553ac63250f8b8a3fcc6 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:32:19 +0000 Subject: [PATCH 15/27] ci: remove reusable workflow version check step --- .github/workflows/release.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f6fd28ad..3fbb04dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -126,21 +126,12 @@ jobs: deno run -ERN "$scriptUrl"; - - name: Check Reusable Workflow Versions - id: workflow-versions-check - continue-on-error: true - env: - BASE_DIR_PATH: "${{ github.workspace }}/.github/workflows" - GITHUB_TOKEN: "${{ secrets.CICD_TOKEN }}" - run: deno run -ERN "${{ steps.build-script-base-url.outputs.url }}/check-workflow-versions.ts"; - - name: Should Fail Job run: | $milestoneExistsCheckFailed = "${{ steps.milestone-exists-check.outcome == 'failure' }}"; $milestoneCheckFailed = "${{ steps.milestone-check.outcome == 'failure' }}"; $releaseNotesCheckFailed = "${{ steps.release-notes-check.outcome == 'failure' }}"; $githubReleaseCheckFailed = "${{ steps.github-release-check.outcome == 'failure' }}"; - $workflowVersionsCheckCheckFailed = "${{ steps.workflow-versions-check.outcome == 'failure' }}"; if ($milestoneExistsCheckFailed -eq "true") { Write-Host "::error::The milestone '${{ needs.get_validate_version.outputs.version }}' does not exist."; @@ -165,8 +156,7 @@ jobs: if ($milestoneExistsCheckFailed -eq "true" ` -or $milestoneCheckFailed -eq "true" ` -or $releaseNotesCheckFailed -eq "true" ` - -or $githubReleaseCheckFailed -eq "true" ` - -or $workflowVersionsCheckCheckFailed -eq "true") { + -or $githubReleaseCheckFailed -eq "true") { exit 1; } From ca43f5b5e6d81e485908fd0a6776ff165d961c06 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:32:45 +0000 Subject: [PATCH 16/27] ci: fix spelling mistake --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fbb04dc..18d07070 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -150,7 +150,7 @@ jobs: } if ($workflowVersionsCheckCheckFailed -eq "true") { - Write-Host "::error::The one or more reusable workflow versions haver not been updated."; + Write-Host "::error::The one or more reusable workflow versions have not been updated."; } if ($milestoneExistsCheckFailed -eq "true" ` From 3ea210f1b02ca5eb1bdfaf8e31879585c17ba735 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:53:08 +0000 Subject: [PATCH 17/27] cleanup: remove unused imports --- .github/internal-cicd/scripts/update-workflow-versions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/internal-cicd/scripts/update-workflow-versions.ts b/.github/internal-cicd/scripts/update-workflow-versions.ts index a9bd9bd1..153ddcb4 100644 --- a/.github/internal-cicd/scripts/update-workflow-versions.ts +++ b/.github/internal-cicd/scripts/update-workflow-versions.ts @@ -1,6 +1,5 @@ import { existsSync, walkSync } from "jsr:@std/fs@1.0.11"; -import { Input } from "jsr:@cliffy/prompt@1.0.0-rc.7"; -import { RepoClient, TagClient } from "jsr:@kinsondigital/kd-clients@1.0.0-preview.14"; +import { RepoClient } from "jsr:@kinsondigital/kd-clients@1.0.0-preview.14"; import getEnvVar from "../../../cicd/core/GetEnvVar.ts"; const scriptFileName = new URL(import.meta.url).pathname.split("/").pop(); From eae789db6c9723d05e1c84c25f4294050f10240c Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:53:23 +0000 Subject: [PATCH 18/27] ci: add deno permissions --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18d07070..091d166b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -238,7 +238,7 @@ jobs: exit 0; } - deno run -EN "${{ github.workspace }}/.github/internal-cicd/scripts/update-workflow-versions.ts"; + deno run -ERWN "${{ github.workspace }}/.github/internal-cicd/scripts/update-workflow-versions.ts"; $releaseType = "${{ inputs.release-type }}"; From 538716258eec426dfc24f2c75386b7e4d42ec7c8 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:55:07 +0000 Subject: [PATCH 19/27] ci: fix spelling mistakes --- .github/workflows/dotnet-action-release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-action-release.yml b/.github/workflows/dotnet-action-release.yml index 8efc41ab..92ce7e90 100644 --- a/.github/workflows/dotnet-action-release.yml +++ b/.github/workflows/dotnet-action-release.yml @@ -134,7 +134,7 @@ jobs: # Verify that the build config is only 'Debug' or 'Release' if ($buildConfig -ne "Debug" -and $buildConfig -ne "Release") { - Write-Host "::error::The build configuration '$buildConfig' is invalid. Expsting a value of 'Debug' or 'Release'."; + Write-Host "::error::The build configuration '$buildConfig' is invalid. Expecting a value of 'Debug' or 'Release'."; exit 1; } @@ -183,8 +183,7 @@ jobs: uses: KinsonDigital/Infrastructure/.github/workflows/validate-sdk-versions.yml@v14.2.0 with: repo-name: "${{ inputs.project-name }}" - secrets: - cicd-pat: "${{ secrets.cicd-pat }}" + validate_release_notes_exist: name: Validate Release Notes Exist @@ -198,7 +197,7 @@ jobs: run: | $relativeDirPath = "${{ inputs.relative-release-notes-dir-path }}"; - # Remove all leading forwaard slashes until none are left + # Remove all leading forward slashes until none are left $relativeDirPath = $relativeDirPath.Replace("\", "/"); $relativeDirPath = $relativeDirPath.TrimStart("/").TrimEnd("/"); From b3e1cef54fcab39ed733e53c1c52301c6e9ec3a0 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:55:23 +0000 Subject: [PATCH 20/27] ide: adjust deno permissions for launch config --- .vscode/launch.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 465e84bc..99a19980 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -398,7 +398,7 @@ "cwd": "${workspaceFolder}", "runtimeArgs": [ "run", - "-ENRWS", + "-ERWN", "--inspect-wait", ], "env": { From 31e2e9f43e822b675c7ad906bf55209b68be8372 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sat, 8 Feb 2025 11:55:32 +0000 Subject: [PATCH 21/27] ide: add words to dictionary --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index d1722d17..0b793b7e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,15 +6,20 @@ "cSpell.words": [ "cicd", "Creds", + "demilestoned", "denoland", "endgroup", + "ERWN", "flatcontainer", "kdadmin", "Kinson", "kinsondigital", "mediumseagreen", + "milestoned", "ncipollo", + "notmatch", "Nums", + "nupkg", "pwsh", "REPONAME", "snupkg", From 44945c8d328b83379265a2e88c9b59e2dd0085ee Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sun, 9 Feb 2025 14:09:33 +0000 Subject: [PATCH 22/27] ci: update release workflow --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 091d166b..fd20050d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -201,9 +201,13 @@ jobs: name: Perform ${{ inputs.release-type }} Release runs-on: ubuntu-latest needs: [get_validate_version, run_prerelease_validation, build, lint] + permissions: + contents: write steps: - name: Checkout Repo uses: actions/checkout@v4 + with: + token: ${{ secrets.CICD_TOKEN }} - name: Set Up Deno uses: denoland/setup-deno@v2 From c3b3ccc902dc28da6eab356187c5b65582ec764f Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sun, 9 Feb 2025 14:18:28 +0000 Subject: [PATCH 23/27] ci: remove workflow version status check and associated scripts --- .../scripts/workflow-version-status-check.ts | 1 - .../workflow-version-status-check.yml | 35 ------ .vscode/launch.json | 25 ----- cicd/scripts/check-workflow-versions.ts | 100 ------------------ 4 files changed, 161 deletions(-) delete mode 100644 .github/internal-cicd/scripts/workflow-version-status-check.ts delete mode 100644 .github/workflows/workflow-version-status-check.yml delete mode 100644 cicd/scripts/check-workflow-versions.ts diff --git a/.github/internal-cicd/scripts/workflow-version-status-check.ts b/.github/internal-cicd/scripts/workflow-version-status-check.ts deleted file mode 100644 index 5c94c7eb..00000000 --- a/.github/internal-cicd/scripts/workflow-version-status-check.ts +++ /dev/null @@ -1 +0,0 @@ -import "../../../cicd/scripts/check-workflow-versions.ts"; diff --git a/.github/workflows/workflow-version-status-check.yml b/.github/workflows/workflow-version-status-check.yml deleted file mode 100644 index 0acb57a3..00000000 --- a/.github/workflows/workflow-version-status-check.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: ✅Workflow Version Status Check - - -defaults: - run: - shell: pwsh - - -on: - pull_request: - branches: [main, preview] - - -jobs: - workflow_version_status_check: - name: Workflow Version Status Check - runs-on: ubuntu-latest - if: ${{ github.event.pull_request.head.ref == vars.PREV_PREP_RELEASE_HEAD_BRANCH || - github.event.pull_request.head.ref == vars.PROD_PREP_RELEASE_HEAD_BRANCH }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set Up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: ${{ vars.DENO_VERSION }} - - - name: Run Status Check Script - env: - OWNER_NAME: "${{ vars.ORGANIZATION_NAME }}" - REPO_NAME: "${{ vars.PROJECT_NAME }}" - BASE_DIR_PATH: "${{ github.workspace }}/.github/workflows" - GITHUB_TOKEN: "${{ secrets.CICD_TOKEN }}" - run: deno run -ERN "${{ github.workspace }}/.github/internal-cicd/scripts/workflow-version-status-check.ts"; diff --git a/.vscode/launch.json b/.vscode/launch.json index 99a19980..68070a9e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -587,31 +587,6 @@ "linux": { "runtimeExecutable": "${userHome}/.deno/bin/deno" } - }, - { // CHECK WORKFLOW VERSIONS - "name": "Check Workflow Versions", - "request": "launch", - "type": "node", - "program": "${workspaceFolder}/cicd/scripts/check-workflow-versions.ts", - "cwd": "${workspaceFolder}", - "runtimeArgs": [ - "run", - "-ERN", - "--inspect-wait", - ], - "env": { - "OWNER_NAME": "KinsonDigital", - "REPO_NAME": "Infrastructure", - "BASE_DIR_PATH": "${workspaceFolder}/.github/workflows", - "GITHUB_TOKEN": "${env:CICD_TOKEN}", - }, - "attachSimplePort": 9229, - "windows": { - "runtimeExecutable": "${userHome}/.deno/bin/deno.exe" - }, - "linux": { - "runtimeExecutable": "${userHome}/.deno/bin/deno" - } }, { // UPDATE CICD SCRIPT VERSION "name": "Update CICD Script Version", diff --git a/cicd/scripts/check-workflow-versions.ts b/cicd/scripts/check-workflow-versions.ts deleted file mode 100644 index ec4d80e7..00000000 --- a/cicd/scripts/check-workflow-versions.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { walkSync } from "jsr:@std/fs@^1.0.4"; -import { exists } from "jsr:@std/fs@^1.0.4"; -import { basename } from "jsr:@std/path@^1.0.6"; -import { TagClient } from "../../deps.ts"; -import { Utils } from "../../cicd/core/Utils.ts"; -import getEnvVar from "../../cicd/core/GetEnvVar.ts"; -import { validateOrgExists, validateRepoExists } from "../../cicd/core/Validators.ts"; - -const scriptFileName = new URL(import.meta.url).pathname.split("/").pop(); - -const ownerName = getEnvVar("OWNER_NAME", scriptFileName); -const repoName = getEnvVar("REPO_NAME", scriptFileName); -let baseDirPath = getEnvVar("BASE_DIR_PATH", scriptFileName); -baseDirPath = Utils.normalizePath(baseDirPath); -const token = getEnvVar("GITHUB_TOKEN", scriptFileName); - -await validateOrgExists(scriptFileName); -await validateRepoExists(scriptFileName); - -if (!exists(baseDirPath)) { - Utils.printAsGitHubError(`Directory '${baseDirPath}' does not exist.`); - Deno.exit(1); -} - -const yamlFiles = [...walkSync(baseDirPath, { - includeDirs: false, - includeFiles: true, - exts: [".yaml", ".yml"], -})].map((e) => e.path); - -const tagClient: TagClient = new TagClient(ownerName, repoName, token); - -const existingReleaseTags = (await tagClient.getAllTags()).map((t) => t.name); - -const workflowsToUpdate: WorkflowToUpdate[] = []; - -const reusableWorkflowRegex = /uses: .+.(yml|yaml)@v([1-9]\d*|0)\.([1-9]\d*|0)\.([1-9]\d*|0)(-preview\.([1-9]\d*))?/gm; - -type WorkflowToUpdate = { - /** - * The file path to the workflow. - */ - filePath: string; - - /** - * The reusable workflow references that need to be updated. - */ - workflowRefs: string[]; -}; - -// Search for workflow references with a version that has not been updated -yamlFiles.forEach((yamlFile) => { - const workflowToUpdate: WorkflowToUpdate = { - filePath: yamlFile, - workflowRefs: [], - }; - - const fileContent = Deno.readTextFileSync(yamlFile); - - const possibleUpdates = fileContent.match(reusableWorkflowRegex)?.map((w) => w) ?? []; - - // Check each reusable workflow reference version - possibleUpdates.forEach((possibleUpdate) => { - const fullRef = possibleUpdate.split("uses:")[1].trim(); - const workflowRefVersion = possibleUpdate.split("@")[1]; - - // If the workflow version has not been updated - if (existingReleaseTags.includes(workflowRefVersion)) { - workflowToUpdate.workflowRefs.push(fullRef); - } - }); - - if (workflowToUpdate.workflowRefs.length > 0) { - workflowsToUpdate.push(workflowToUpdate); - } -}); - -// If there are no workflows to update, then exit -if (workflowsToUpdate.length === 0) { - Utils.printAsGitHubNotice("No workflows to update."); - Deno.exit(0); -} - -const errorMsgs: string[] = []; - -// Print out all of the workflows that need to be updated as an error -workflowsToUpdate.forEach((workflowToUpdate) => { - const filePath = basename(workflowToUpdate.filePath); - - const workflowErrors: string[] = workflowToUpdate.workflowRefs.map((workflowRef) => { - return `Workflow reference '${workflowRef}' in file '${filePath}' needs to be updated.`; - }); - - errorMsgs.push(...workflowErrors); -}); - -if (errorMsgs.length > 0) { - Utils.printAsGitHubErrors(errorMsgs); - Deno.exit(1); -} From 88f5b2d340520c5596e90f3b36bc2ca48a940fd7 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sun, 9 Feb 2025 14:24:02 +0000 Subject: [PATCH 24/27] ci: update step names --- .github/workflows/add-item-to-project.yml | 2 +- .github/workflows/dotnet-lib-release.yml | 4 ++-- .github/workflows/initial-manual-sync.yml | 2 +- .github/workflows/lint-status-check.yml | 2 +- .github/workflows/nuget-package-does-not-exist.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/sync-bot.yml | 2 +- .github/workflows/validate-csharp-version.yml | 2 +- .github/workflows/validate-github-release.yml | 2 +- .github/workflows/validate-milestone-status.yml | 2 +- .github/workflows/validate-sdk-versions.yml | 2 +- .github/workflows/validate-tag.yml | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/add-item-to-project.yml b/.github/workflows/add-item-to-project.yml index a7e61a70..4a1631b6 100644 --- a/.github/workflows/add-item-to-project.yml +++ b/.github/workflows/add-item-to-project.yml @@ -61,7 +61,7 @@ jobs: exit 1; } - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/dotnet-lib-release.yml b/.github/workflows/dotnet-lib-release.yml index deb02de3..e964fc5d 100644 --- a/.github/workflows/dotnet-lib-release.yml +++ b/.github/workflows/dotnet-lib-release.yml @@ -109,7 +109,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} @@ -317,7 +317,7 @@ jobs: - name: Setup Nuget uses: NuGet/setup-nuget@v1 - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/initial-manual-sync.yml b/.github/workflows/initial-manual-sync.yml index ab997646..52d75064 100644 --- a/.github/workflows/initial-manual-sync.yml +++ b/.github/workflows/initial-manual-sync.yml @@ -78,7 +78,7 @@ jobs: "$stepOutput" >> $env:GITHUB_OUTPUT; - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) if: ${{ steps.skip-checking.outputs.skip == 'false' }} uses: denoland/setup-deno@v2 with: diff --git a/.github/workflows/lint-status-check.yml b/.github/workflows/lint-status-check.yml index 39d3b983..ae581a2c 100644 --- a/.github/workflows/lint-status-check.yml +++ b/.github/workflows/lint-status-check.yml @@ -19,7 +19,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/nuget-package-does-not-exist.yml b/.github/workflows/nuget-package-does-not-exist.yml index f312ef44..af28da23 100644 --- a/.github/workflows/nuget-package-does-not-exist.yml +++ b/.github/workflows/nuget-package-does-not-exist.yml @@ -52,7 +52,7 @@ jobs: needs: print_validate_workflow runs-on: ubuntu-latest steps: - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd20050d..54f83291 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,7 +55,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} @@ -209,7 +209,7 @@ jobs: with: token: ${{ secrets.CICD_TOKEN }} - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/sync-bot.yml b/.github/workflows/sync-bot.yml index fe7b0c56..9c314b7d 100644 --- a/.github/workflows/sync-bot.yml +++ b/.github/workflows/sync-bot.yml @@ -17,7 +17,7 @@ jobs: if: ${{ !github.event.issue.pull_request }} runs-on: ubuntu-latest steps: - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/validate-csharp-version.yml b/.github/workflows/validate-csharp-version.yml index 5972835b..76ae59e2 100644 --- a/.github/workflows/validate-csharp-version.yml +++ b/.github/workflows/validate-csharp-version.yml @@ -72,7 +72,7 @@ jobs: file-path: '${{ inputs.project-name }}/${{ inputs.project-name }}.csproj' version-keys: Version - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/validate-github-release.yml b/.github/workflows/validate-github-release.yml index c9786eab..b16b5edf 100644 --- a/.github/workflows/validate-github-release.yml +++ b/.github/workflows/validate-github-release.yml @@ -65,7 +65,7 @@ jobs: needs: print_validate_workflow runs-on: ubuntu-latest steps: - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/validate-milestone-status.yml b/.github/workflows/validate-milestone-status.yml index fd8caeb4..5b7e2ce2 100644 --- a/.github/workflows/validate-milestone-status.yml +++ b/.github/workflows/validate-milestone-status.yml @@ -68,7 +68,7 @@ jobs: needs: print_validate_workflow runs-on: ubuntu-latest steps: - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/validate-sdk-versions.yml b/.github/workflows/validate-sdk-versions.yml index a49e854c..d3c1c565 100644 --- a/.github/workflows/validate-sdk-versions.yml +++ b/.github/workflows/validate-sdk-versions.yml @@ -39,7 +39,7 @@ jobs: exit 1; } - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/validate-tag.yml b/.github/workflows/validate-tag.yml index 690c14e9..9cf7c6e6 100644 --- a/.github/workflows/validate-tag.yml +++ b/.github/workflows/validate-tag.yml @@ -77,7 +77,7 @@ jobs: name: Validate Tag runs-on: ubuntu-latest steps: - - name: Set Up Deno + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} From c74fca2f6d234aad203f83eb1ca4a6cd7b7aa854 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sun, 9 Feb 2025 14:32:43 +0000 Subject: [PATCH 25/27] ci: update all action versions --- .github/workflows/build-csharp-project.yml | 2 +- .github/workflows/docusaurus-release.yml | 8 ++++---- .github/workflows/dotnet-lib-release.yml | 4 ++-- .github/workflows/run-csharp-tests.yml | 2 +- .github/workflows/validate-csharp-version.yml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-csharp-project.yml b/.github/workflows/build-csharp-project.yml index 609c5f15..d385ab73 100644 --- a/.github/workflows/build-csharp-project.yml +++ b/.github/workflows/build-csharp-project.yml @@ -109,7 +109,7 @@ jobs: ref: ${{ inputs.checkout-ref }} - name: Setup .NET SDK ${{ inputs.net-sdk-version }} - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ inputs.net-sdk-version }} diff --git a/.github/workflows/docusaurus-release.yml b/.github/workflows/docusaurus-release.yml index 3116f6c7..5cae39c2 100644 --- a/.github/workflows/docusaurus-release.yml +++ b/.github/workflows/docusaurus-release.yml @@ -117,7 +117,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node (v${{ inputs.node-version }}) - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} @@ -131,16 +131,16 @@ jobs: run: yarn build - name: Setup Pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v5 - name: Upload Artifact - uses: actions/upload-pages-artifact@v2.0.0 + uses: actions/upload-pages-artifact@v3 with: path: '${{ inputs.artifact-dir-path }}' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 - name: Create Release Tag (${{ inputs.release-version }}) run: | diff --git a/.github/workflows/dotnet-lib-release.yml b/.github/workflows/dotnet-lib-release.yml index e964fc5d..7ab7fb87 100644 --- a/.github/workflows/dotnet-lib-release.yml +++ b/.github/workflows/dotnet-lib-release.yml @@ -310,12 +310,12 @@ jobs: uses: actions/checkout@v4 - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: "${{ inputs.net-sdk-version }}" - name: Setup Nuget - uses: NuGet/setup-nuget@v1 + uses: NuGet/setup-nuget@v2 - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 diff --git a/.github/workflows/run-csharp-tests.yml b/.github/workflows/run-csharp-tests.yml index 74385411..dda33caa 100644 --- a/.github/workflows/run-csharp-tests.yml +++ b/.github/workflows/run-csharp-tests.yml @@ -110,7 +110,7 @@ jobs: repository: ${{ inputs.checkout-repository }} ref: ${{ inputs.checkout-ref }} - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ inputs.net-sdk-version }} diff --git a/.github/workflows/validate-csharp-version.yml b/.github/workflows/validate-csharp-version.yml index 76ae59e2..1e2d120f 100644 --- a/.github/workflows/validate-csharp-version.yml +++ b/.github/workflows/validate-csharp-version.yml @@ -62,7 +62,7 @@ jobs: steps: - name: Get Version From Project File id: get-version - uses: KinsonDigital/VersionMiner@v1.0.0-preview.5 + uses: KinsonDigital/VersionMiner@v1.0.0 with: repo-owner: ${{ vars.ORGANIZATION_NAME }} repo-name: ${{ inputs.project-name }} From f6dc211f4d1bcb6fa88e82fb269f38c38eef63c8 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sun, 9 Feb 2025 14:49:56 +0000 Subject: [PATCH 26/27] ci: improve step names --- .github/workflows/build-csharp-project.yml | 2 +- .github/workflows/build-status-check.yml | 2 +- .github/workflows/docusaurus-release.yml | 6 +++--- .github/workflows/dotnet-lib-release.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-csharp-project.yml b/.github/workflows/build-csharp-project.yml index d385ab73..14bd15b8 100644 --- a/.github/workflows/build-csharp-project.yml +++ b/.github/workflows/build-csharp-project.yml @@ -108,7 +108,7 @@ jobs: repository: ${{ inputs.checkout-repository }} ref: ${{ inputs.checkout-ref }} - - name: Setup .NET SDK ${{ inputs.net-sdk-version }} + - name: Set Up .NET SDK (${{ inputs.net-sdk-version }}) uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ inputs.net-sdk-version }} diff --git a/.github/workflows/build-status-check.yml b/.github/workflows/build-status-check.yml index 56a61bc5..4d5a7b10 100644 --- a/.github/workflows/build-status-check.yml +++ b/.github/workflows/build-status-check.yml @@ -23,7 +23,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} - - name: Setup Deno (${{ vars.DENO_VERSION }}) + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} diff --git a/.github/workflows/docusaurus-release.yml b/.github/workflows/docusaurus-release.yml index 5cae39c2..d1b59f8e 100644 --- a/.github/workflows/docusaurus-release.yml +++ b/.github/workflows/docusaurus-release.yml @@ -116,7 +116,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node (v${{ inputs.node-version }}) + - name: Set Up Node (v${{ inputs.node-version }}) uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} @@ -124,13 +124,13 @@ jobs: - name: Setup YARN run: npm install --global yarn - - name: Setup Docusaurus + - name: Set Up Docusaurus run: yarn install - name: Build Site run: yarn build - - name: Setup Pages + - name: Set Up Pages uses: actions/configure-pages@v5 - name: Upload Artifact diff --git a/.github/workflows/dotnet-lib-release.yml b/.github/workflows/dotnet-lib-release.yml index 7ab7fb87..98b3b2e2 100644 --- a/.github/workflows/dotnet-lib-release.yml +++ b/.github/workflows/dotnet-lib-release.yml @@ -309,12 +309,12 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup .NET SDK + - name: Set Up .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: "${{ inputs.net-sdk-version }}" - - name: Setup Nuget + - name: Set Up Nuget uses: NuGet/setup-nuget@v2 - name: Set Up Deno (${{ vars.DENO_VERSION }}) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54f83291..74d45567 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -168,7 +168,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Deno (${{ vars.DENO_VERSION }}) + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} @@ -184,7 +184,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Deno (${{ vars.DENO_VERSION }}) + - name: Set Up Deno (${{ vars.DENO_VERSION }}) uses: denoland/setup-deno@v2 with: deno-version: ${{ vars.DENO_VERSION }} From 6942bc315f042c5bf0e090dbf473018af8b66cf8 Mon Sep 17 00:00:00 2001 From: CalvinWilkinson Date: Sun, 9 Feb 2025 14:50:27 +0000 Subject: [PATCH 27/27] ci: replace yarn with pnpm --- .github/workflows/docusaurus-release.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docusaurus-release.yml b/.github/workflows/docusaurus-release.yml index d1b59f8e..4d6e6a71 100644 --- a/.github/workflows/docusaurus-release.yml +++ b/.github/workflows/docusaurus-release.yml @@ -121,14 +121,16 @@ jobs: with: node-version: ${{ inputs.node-version }} - - name: Setup YARN - run: npm install --global yarn + - name: Setup PNPM (${{ vars.PNPM_VERSION }}) + uses: pnpm/action-setup@v4 + with: + version: ${{ vars.PNPM_VERSION }} - name: Set Up Docusaurus - run: yarn install + run: pnpm install - name: Build Site - run: yarn build + run: pnpm exec docusaurus build - name: Set Up Pages uses: actions/configure-pages@v5