From 9b4ae0868d5f5a5ef1d49843737f950bbb841cbf Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 19 Jul 2022 16:35:58 -0400 Subject: [PATCH] chore: update deno automation to 0.12 (#15248) --- .github/workflows/cargo_publish.yml | 2 +- tools/deno.lock.json | 75 +++++++++++++++++------- tools/release/01_bump_crate_versions.ts | 16 ++--- tools/release/02_create_pr.ts | 12 ++-- tools/release/03_publish_crates.ts | 35 ++--------- tools/release/04_post_publish.ts | 29 +++++---- tools/release/05_create_release_notes.ts | 6 +- tools/release/deno_workspace.ts | 22 +++---- tools/release/deps.ts | 4 +- 9 files changed, 103 insertions(+), 98 deletions(-) diff --git a/.github/workflows/cargo_publish.yml b/.github/workflows/cargo_publish.yml index 6c8bd40b56..f3f354543b 100644 --- a/.github/workflows/cargo_publish.yml +++ b/.github/workflows/cargo_publish.yml @@ -37,7 +37,7 @@ jobs: - name: Publish env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - run: ./tools/release/03_publish_crates.ts --real + run: ./tools/release/03_publish_crates.ts - name: Create release tag and check forward commit to main env: diff --git a/tools/deno.lock.json b/tools/deno.lock.json index 4da5a41c06..1a61746451 100644 --- a/tools/deno.lock.json +++ b/tools/deno.lock.json @@ -106,17 +106,38 @@ "https://deno.land/std@0.108.0/path/win32.ts": "2edb2f71f10578ee1168de01a8cbd3c65483e45a46bc2fa3156a0c6bfbd2720d", "https://deno.land/std@0.108.0/testing/_diff.ts": "ccd6c3af6e44c74bf1591acb1361995f5f50df64323a6e7fb3f16c8ea792c940", "https://deno.land/std@0.108.0/testing/asserts.ts": "6b0d6ba564bdff807bd0f0e93e02c48aa3177acf19416bf84a7f420191ef74cd", - "https://deno.land/std@0.127.0/_util/assert.ts": "6396c1bd0361c4939e7f32f9b03efffcd04b640a1b206ed67058553d6cb59cc4", - "https://deno.land/std@0.127.0/_util/os.ts": "49b92edea1e82ba295ec946de8ffd956ed123e2948d9bd1d3e901b04e4307617", - "https://deno.land/std@0.127.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3", - "https://deno.land/std@0.127.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09", - "https://deno.land/std@0.127.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b", - "https://deno.land/std@0.127.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633", - "https://deno.land/std@0.127.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee", - "https://deno.land/std@0.127.0/path/mod.ts": "4275129bb766f0e475ecc5246aa35689eeade419d72a48355203f31802640be7", - "https://deno.land/std@0.127.0/path/posix.ts": "663e4a6fe30a145f56aa41a22d95114c4c5582d8b57d2d7c9ed27ad2c47636bb", - "https://deno.land/std@0.127.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9", - "https://deno.land/std@0.127.0/path/win32.ts": "e7bdf63e8d9982b4d8a01ef5689425c93310ece950e517476e22af10f41a136e", + "https://deno.land/std@0.147.0/_deno_unstable.ts": "be3276fd42cffb49f51b705c4b0aa8656aaf2a34be22d769455c8e50ea38e51a", + "https://deno.land/std@0.147.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.147.0/_util/os.ts": "3b4c6e27febd119d36a416d7a97bd3b0251b77c88942c8f16ee5953ea13e2e49", + "https://deno.land/std@0.147.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", + "https://deno.land/std@0.147.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", + "https://deno.land/std@0.147.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf", + "https://deno.land/std@0.147.0/fmt/colors.ts": "6f9340b7fb8cc25a993a99e5efc56fe81bb5af284ff412129dd06df06f53c0b4", + "https://deno.land/std@0.147.0/fs/_util.ts": "2cf50bfb1081c2d5f2efec10ac19abbc2baf478e51cd1b057d0da2f30585b6ba", + "https://deno.land/std@0.147.0/fs/copy.ts": "9248d1492599957af8c693ceb10a432b09f0b0b61c60a4d6aff29b0c7d3a17b3", + "https://deno.land/std@0.147.0/fs/empty_dir.ts": "7274d87160de34cbed0531e284df383045cf43543bbeadeb97feac598bd8f3c5", + "https://deno.land/std@0.147.0/fs/ensure_dir.ts": "9dc109c27df4098b9fc12d949612ae5c9c7169507660dcf9ad90631833209d9d", + "https://deno.land/std@0.147.0/fs/ensure_file.ts": "7d353e64fee3d4d1e7c6b6726a2a5e987ba402c15fb49566309042887349c545", + "https://deno.land/std@0.147.0/fs/ensure_link.ts": "489e23df9fe3e6636048b5830ddf0f111eb29621eb85719255ad9bd645f3471b", + "https://deno.land/std@0.147.0/fs/ensure_symlink.ts": "88dc83de1bc90ed883dd458c2d2eae3d5834a4617d12925734836e1f0803b274", + "https://deno.land/std@0.147.0/fs/eol.ts": "b92f0b88036de507e7e6fbedbe8f666835ea9dcbf5ac85917fa1fadc919f83a5", + "https://deno.land/std@0.147.0/fs/exists.ts": "cb734d872f8554ea40b8bff77ad33d4143c1187eac621a55bf37781a43c56f6d", + "https://deno.land/std@0.147.0/fs/expand_glob.ts": "143400698822117018c3646f4b7d2d418bc5cdede1ec837a8c70013b7711c761", + "https://deno.land/std@0.147.0/fs/mod.ts": "7111008fcdf935f1bfdf07f881f4d1e152063d146025e9622ae12d1fd5f4d7b8", + "https://deno.land/std@0.147.0/fs/move.ts": "0573cedcf583f09a9494f2dfccbf67de68a93629942d6b5e6e74a9e45d4e8a2e", + "https://deno.land/std@0.147.0/fs/walk.ts": "6ce8d87fbaeda23383e979599ad27f3f94b3e5ff0c0cd976b5fc5c2aa0df7d92", + "https://deno.land/std@0.147.0/io/buffer.ts": "bd0c4bf53db4b4be916ca5963e454bddfd3fcd45039041ea161dbf826817822b", + "https://deno.land/std@0.147.0/io/types.d.ts": "0cae3a62da7a37043661746c65c021058bae020b54e50c0e774916e5d4baee43", + "https://deno.land/std@0.147.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3", + "https://deno.land/std@0.147.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09", + "https://deno.land/std@0.147.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b", + "https://deno.land/std@0.147.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633", + "https://deno.land/std@0.147.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee", + "https://deno.land/std@0.147.0/path/mod.ts": "4945b430b759b0b3d98f2a278542cbcf95e0ad2bd8eaaed3c67322b306b2b346", + "https://deno.land/std@0.147.0/path/posix.ts": "c1f7afe274290ea0b51da07ee205653b2964bd74909a82deb07b69a6cc383aaa", + "https://deno.land/std@0.147.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9", + "https://deno.land/std@0.147.0/path/win32.ts": "bd7549042e37879c68ff2f8576a25950abbfca1d696d41d82c7bca0b7e6f452c", + "https://deno.land/std@0.147.0/streams/conversion.ts": "fc3db02026183da795fa32ac7549868e9f19c75ba029d4b4c3739af62b48517a", "https://deno.land/x/compress@v0.4.1/deps.ts": "b23619920334f637497a5a236e40ec259707463fdc3692fdb375b6399fc0280a", "https://deno.land/x/compress@v0.4.1/gzip/gzip.ts": "4bf22e9cd3368332928324dd9443ef72cabd05e9234e5a37dd7b3517d50e945e", "https://deno.land/x/compress@v0.4.1/gzip/gzip_file.ts": "b044ec0df4266c084baa033a4ab5394882e44a86d09d5616636467dcb39c671d", @@ -140,6 +161,19 @@ "https://deno.land/x/compress@v0.4.1/zlib/zlib/trees.ts": "6b65a767646e031e87e7b725ffad0c511fe701f393a01652e1e7ee8884f60fee", "https://deno.land/x/compress@v0.4.1/zlib/zlib/zstream.ts": "c110fd5919235e317d64933852e24a1bba0126202be592e90e58f7b19315ad93", "https://deno.land/x/crc32@v0.2.0/mod.ts": "de7a3fa2d4ef24b96fc21e1cc4d2d65d1d2b1dcea92f63960e3e11bfa82df0fa", + "https://deno.land/x/dax@0.7.1/lib/rs_lib.generated.js": "c4d29beff18383609dd91f23f2bf39617f4d3f350aabf4499f43fd95448fb651", + "https://deno.land/x/dax@0.7.1/mod.ts": "a738ad8a6910edab7c334b32cf03679cd2594bfa405debf8af03df82c6ab3e81", + "https://deno.land/x/dax@0.7.1/src/command.ts": "a62691337a0d9aff3eeb7d4ff688d0e0e56750fca9b1372aa875d007067ca08c", + "https://deno.land/x/dax@0.7.1/src/commands/cd.ts": "cb3c00decd8037ff9505bfb19f0dabfa8f151ad22efdfa9a27618c5733deb0da", + "https://deno.land/x/dax@0.7.1/src/commands/echo.ts": "9803a078dca3b65b08b892e35d885468f3a3569be38c84e39758256811d0d756", + "https://deno.land/x/dax@0.7.1/src/commands/export.ts": "754a1600a441e18545a7d5a239437f8e823bfd7079cc637989d2473507f3a62b", + "https://deno.land/x/dax@0.7.1/src/commands/sleep.ts": "8b5dffa3742a3f8ad2a93e81120e56857814be3d9d41e3ee2dd8d616ff121c8a", + "https://deno.land/x/dax@0.7.1/src/common.ts": "c43b15084a6c6b8675f012eb48daabf3f7dc89e76b2160eb559e762d65d4f643", + "https://deno.land/x/dax@0.7.1/src/deps.ts": "a6ad51c3ca8d4411e5768ce4e943349d272c43a1e943fdb46f2f62dc59a91155", + "https://deno.land/x/dax@0.7.1/src/pipes.ts": "84eda4be883b90fc950e54770e1c809a68d395790da3e4064c6f7b28702bf354", + "https://deno.land/x/dax@0.7.1/src/request.ts": "aa25ac908adb33d8e8ec45cfded9387959667c1b565da75a5df93f357d9c1080", + "https://deno.land/x/dax@0.7.1/src/result.ts": "c0cd24e377548990f3de240606bd1a205c0428c0252bd7c5ef9be92a93d54ffc", + "https://deno.land/x/dax@0.7.1/src/shell.ts": "cdab0db18654d2bf5058e8d220cdbefc308c6b2549bb56e8d01aea5ce5a7b60a", "https://deno.land/x/deno_dom@v0.1.3-alpha2/build/deno-wasm/deno-wasm.js": "82c270a48886f86e0e9ea6e5e70a6e37836181466cb9a41942420c884e0d3db9", "https://deno.land/x/deno_dom@v0.1.3-alpha2/deno-dom-wasm.ts": "097cb6382dd8a335f9409e899873a103d7fbe7cbe06b32fd11b5bbc58305f6dc", "https://deno.land/x/deno_dom@v0.1.3-alpha2/src/api.ts": "fe91e8c83ce491d0bd5fe5d0ae4c7c99754b88cb6e69e818683e10e43e01bf10", @@ -155,13 +189,14 @@ "https://deno.land/x/deno_dom@v0.1.3-alpha2/src/dom/nwsapi.js": "8a52f4d0b8d0371bfeefed5314f90b5623fcdfc2e4450b0ae54eb137f778a634", "https://deno.land/x/deno_dom@v0.1.3-alpha2/src/parser.ts": "bda4ab4a1c9a2e156877f33ee4e60caac935a7c995a86bbe026bdc0f0d31b8c1", "https://deno.land/x/semver@v1.4.0/mod.ts": "c3e08f7f0a3e625015ecc9a46cf79a9dc3f081f3c5b3037d3c49c0773e58d265", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/cargo.ts": "a41c2b22e288106c7e843442dc3d4e554a42ec70eab8ebafb88290f41d61ed49", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/crate.ts": "fa4cc69c9a6ec14215ac04d4e3f477c74f59cb21026252535760e35650e83f1f", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/crates_io.ts": "668a31484cea5b01ef3eba119d8a8f20457307daca5bd2a32bea291cfbbc7514", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/deps.ts": "8373d9822dfe29980bcc39fa2700861d120cfae828d9586f94e019d69619502b", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/github_actions.ts": "3c4b334a94cfb0f6838d9cf30041ad3316c744ffc75cae7b5aad54b61b6c15de", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/helpers.ts": "e4ba40ef19d7656fcaf1c6b2532b794320ff56cd0997b36a71fcd86f2574cdad", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/mod.ts": "0f43493d5ecbaf415b32992719f6b7533951a7ee75ffc27457290066149652cb", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/releases_md.ts": "b30eb02a3ea3da70807c491dc4fe5b8185b91b84fc33bb27a6f2cd8a2aa09c7c", - "https://raw.githubusercontent.com/denoland/automation/0.11.0/repo.ts": "ce0c6148c5563d805c28952cd47f4c159a6a56fa97801de0c61a3377748cbe45" + "https://deno.land/x/which@0.2.1/mod.ts": "2e076cb85aea9798662b355fb613d27eebcc78dfc8934ece4ae932f6303f6ca8", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/cargo.ts": "3177259ac2370739151ada437c71682b6c3f1be7151d0f555666b42af79a31e2", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/crate.ts": "da80a6db190e9edba75b603d3a9a14e863136e53dabc59b255d15b8caa147364", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/crates_io.ts": "3ff42c79874ab1a422849381d8e8bd2397aeda206aef34e0022f691d1b2090e0", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/deps.ts": "4cdcd195ea494d3d5dce08e561f8bb12e63486402f742b00e168645add84de17", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/github_actions.ts": "3c4b334a94cfb0f6838d9cf30041ad3316c744ffc75cae7b5aad54b61b6c15de", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/helpers.ts": "5e6f51b15b94db597162f4bcea7e275ef0e0eccbaec940393d8dbabf44c195d7", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/mod.ts": "a5a905605448b872bb5671a3c36f6f022a32509f9bff8a932c68b7db9e1d5cd5", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/releases_md.ts": "b30eb02a3ea3da70807c491dc4fe5b8185b91b84fc33bb27a6f2cd8a2aa09c7c", + "https://raw.githubusercontent.com/denoland/automation/0.12.1/repo.ts": "cf99b4e7f80fb3bab4264bb0913c5756c1272593360f229d68cc55b635afdf71" } diff --git a/tools/release/01_bump_crate_versions.ts b/tools/release/01_bump_crate_versions.ts index b2d160fc64..d2446d44c2 100755 --- a/tools/release/01_bump_crate_versions.ts +++ b/tools/release/01_bump_crate_versions.ts @@ -1,7 +1,7 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo,git,deno --allow-net --no-check --lock=tools/deno.lock.json +#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; -import { GitLogOutput, path, semver } from "./deps.ts"; +import { $, GitLogOutput, semver } from "./deps.ts"; const workspace = await DenoWorkspace.load(); const repo = workspace.repo; @@ -25,7 +25,7 @@ for (const crate of workspace.getCliDependencyCrates()) { } // update the std version used in the code -console.log("Updating std version..."); +$.logStep("Updating std version..."); await updateStdVersion(); // update the lock file @@ -33,12 +33,12 @@ await workspace.getCliCrate().cargoUpdate("--workspace"); // try to update the Releases.md markdown text try { - console.log("Updating Releases.md..."); + $.logStep("Updating Releases.md..."); await updateReleasesMd(); } catch (err) { - console.error(err); - console.error( - "Updating Releases.md failed. Please manually run " + + $.log(err); + $.logError( + "Error Updating Releases.md failed. Please manually run " + "`git log --oneline VERSION_FROM..VERSION_TO` and " + "use the output to update Releases.md", ); @@ -97,7 +97,7 @@ async function getGitLog() { } async function updateStdVersion() { - const compatFilePath = path.join(cliCrate.folderPath, "compat/mod.rs"); + const compatFilePath = $.path.join(cliCrate.folderPath, "compat/mod.rs"); const text = await Deno.readTextFile(compatFilePath); const versionRe = /std@([0-9]+\.[0-9]+\.[0-9]+)/; const stdVersionText = versionRe.exec(text)?.[1]; diff --git a/tools/release/02_create_pr.ts b/tools/release/02_create_pr.ts index 165dc3d34f..0c0ab7b730 100755 --- a/tools/release/02_create_pr.ts +++ b/tools/release/02_create_pr.ts @@ -1,7 +1,7 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run=cargo,git --no-check --lock=tools/deno.lock.json +#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; -import { createOctoKit, getGitHubRepository } from "./deps.ts"; +import { $, createOctoKit, getGitHubRepository } from "./deps.ts"; const octoKit = createOctoKit(); const workspace = await DenoWorkspace.load(); @@ -12,15 +12,15 @@ const originalBranch = await repo.gitCurrentBranch(); const newBranchName = `release_${cliCrate.version.replace(/\./, "_")}`; // Create and push branch -console.log(`Creating branch ${newBranchName}...`); +$.logStep(`Creating branch ${newBranchName}...`); await repo.gitBranch(newBranchName); await repo.gitAdd(); await repo.gitCommit(cliCrate.version); -console.log("Pushing branch..."); +$.logStep("Pushing branch..."); await repo.gitPush("-u", "origin", "HEAD"); // Open PR -console.log("Opening PR..."); +$.logStep("Opening PR..."); const openedPr = await octoKit.request("POST /repos/{owner}/{repo}/pulls", { ...getGitHubRepository(), base: originalBranch, @@ -29,7 +29,7 @@ const openedPr = await octoKit.request("POST /repos/{owner}/{repo}/pulls", { title: cliCrate.version, body: getPrBody(), }); -console.log(`Opened PR at ${openedPr.data.url}`); +$.log(`Opened PR at ${openedPr.data.url}`); function getPrBody() { let text = `Bumped versions for ${cliCrate.version}\n\n` + diff --git a/tools/release/03_publish_crates.ts b/tools/release/03_publish_crates.ts index 0becd3d26f..4e149d3b9c 100755 --- a/tools/release/03_publish_crates.ts +++ b/tools/release/03_publish_crates.ts @@ -1,10 +1,9 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo --allow-net=crates.io --no-check --lock=tools/deno.lock.json +#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; -import { Crate, getCratesPublishOrder } from "./deps.ts"; +import { $, getCratesPublishOrder } from "./deps.ts"; -const isReal = parseIsReal(); -console.log(`Running a ${isReal ? "real" : "dry"} cargo publish...`); +$.logStep(`Running cargo publish...`); const workspace = await DenoWorkspace.load(); const cliCrate = workspace.getCliCrate(); @@ -15,34 +14,12 @@ const dependencyCrates = getCratesPublishOrder( try { for (const [i, crate] of dependencyCrates.entries()) { - await publishCrate(crate); - console.log(`Finished ${i + 1} of ${dependencyCrates.length} crates.`); + await crate.publish(); + $.log(`Finished ${i + 1} of ${dependencyCrates.length} crates.`); } - await publishCrate(cliCrate); + await cliCrate.publish(); } finally { // system beep to notify error or completion console.log("\x07"); } - -async function publishCrate(crate: Crate) { - if (isReal) { - await crate.publish(); - } else { - await crate.publishDryRun(); - } -} - -function parseIsReal() { - const isReal = Deno.args.some((a) => a === "--real"); - const isDry = Deno.args.some((a) => a === "--dry"); - - // force the call to be explicit and provide one of these - // so that it's obvious what's happening - if (!isDry && !isReal) { - console.error("Please run with `--dry` or `--real`."); - Deno.exit(1); - } - - return isReal; -} diff --git a/tools/release/04_post_publish.ts b/tools/release/04_post_publish.ts index 228bd775c4..03b005db5b 100755 --- a/tools/release/04_post_publish.ts +++ b/tools/release/04_post_publish.ts @@ -1,20 +1,20 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo,git --allow-net --allow-env --no-check --lock=tools/deno.lock.json +#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; -import { createOctoKit, getGitHubRepository } from "./deps.ts"; +import { $, createOctoKit, getGitHubRepository } from "./deps.ts"; const workspace = await DenoWorkspace.load(); const repo = workspace.repo; const cliCrate = workspace.getCliCrate(); -console.log("Creating release tag..."); +$.logStep("Creating release tag..."); await createReleaseTag(); -console.log("Forwarding release commit to main..."); +$.logStep("Forwarding release commit to main..."); try { await forwardReleaseCommitToMain(); } catch (err) { - console.error("Failed. Please manually open a PR.", err); + $.logError("Failed. Please manually open a PR.", err); } async function createReleaseTag() { @@ -23,7 +23,7 @@ async function createReleaseTag() { const tagName = `v${cliCrate.version}`; if (tags.has(tagName)) { - console.log(`Tag ${tagName} already exists.`); + $.log(`Tag ${tagName} already exists.`); } else { await repo.gitTag(tagName); await repo.gitPush("origin", tagName); @@ -36,23 +36,22 @@ async function forwardReleaseCommitToMain() { const isPatchRelease = currentBranch !== "main"; if (!isPatchRelease) { - console.log("Not doing a patch release. Skipping."); + $.log("Not doing a patch release. Skipping."); return; } - await repo.runCommandWithOutput(["git", "fetch", "origin", "main"]); - const releaseCommitHash = - (await repo.runCommand(["git", "rev-parse", "HEAD"])).trim(); + await repo.command("git fetch origin main"); + const releaseCommitHash = await repo.command("git rev-parse HEAD").text(); const newBranchName = `forward_v${cliCrate.version}`; - console.log(`Creating branch ${newBranchName}...`); - await repo.runCommand([ + $.logStep(`Creating branch ${newBranchName}...`); + await repo.command([ "git", "checkout", "-b", newBranchName, "origin/main", ]); - await repo.runCommand([ + await repo.command([ "git", "cherry-pick", "--strategy-option", @@ -61,7 +60,7 @@ async function forwardReleaseCommitToMain() { ]); await repo.gitPush("origin", newBranchName); - console.log(`Opening PR...`); + $.logStep(`Opening PR...`); const openedPr = await createOctoKit().request( "POST /repos/{owner}/{repo}/pulls", { @@ -73,7 +72,7 @@ async function forwardReleaseCommitToMain() { body: getPrBody(), }, ); - console.log(`Opened PR at ${openedPr.data.url}`); + $.log(`Opened PR at ${openedPr.data.url}`); function getPrBody() { let text = diff --git a/tools/release/05_create_release_notes.ts b/tools/release/05_create_release_notes.ts index af33309530..26667b5efc 100755 --- a/tools/release/05_create_release_notes.ts +++ b/tools/release/05_create_release_notes.ts @@ -1,12 +1,12 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo,git --no-check --lock=tools/deno.lock.json +#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import { path } from "./deps.ts"; +import { $ } from "./deps.ts"; import { DenoWorkspace } from "./deno_workspace.ts"; const workspace = await DenoWorkspace.load(); // create a release notes file for the GH release draft await Deno.writeTextFile( - path.join(DenoWorkspace.rootDirPath, "./target/release/release-notes.md"), + $.path.join(DenoWorkspace.rootDirPath, "./target/release/release-notes.md"), workspace.getReleasesMdFile().getLatestReleaseText().fullText, ); diff --git a/tools/release/deno_workspace.ts b/tools/release/deno_workspace.ts index 2ffac6ccac..892986ac04 100644 --- a/tools/release/deno_workspace.ts +++ b/tools/release/deno_workspace.ts @@ -1,13 +1,13 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import { path, ReleasesMdFile, Repo } from "./deps.ts"; +import { $, ReleasesMdFile, Repo } from "./deps.ts"; export class DenoWorkspace { #repo: Repo; static get rootDirPath() { - const currentDirPath = path.dirname(path.fromFileUrl(import.meta.url)); - return path.resolve(currentDirPath, "../../"); + const currentDirPath = $.path.dirname($.path.fromFileUrl(import.meta.url)); + return $.path.resolve(currentDirPath, "../../"); } static async load(): Promise { @@ -48,19 +48,13 @@ export class DenoWorkspace { getReleasesMdFile() { return new ReleasesMdFile( - path.join(DenoWorkspace.rootDirPath, "Releases.md"), + $.path.join(DenoWorkspace.rootDirPath, "Releases.md"), ); } - runFormatter() { - return this.#repo.runCommandWithOutput([ - "deno", - "run", - "--unstable", - "--allow-write", - "--allow-read", - "--allow-run", - "./tools/format.js", - ]); + async runFormatter() { + await this.#repo.command( + "deno run --unstable --allow-write --allow-read --allow-run ./tools/format.js", + ); } } diff --git a/tools/release/deps.ts b/tools/release/deps.ts index 4b8d6a3c2c..5c33e65488 100644 --- a/tools/release/deps.ts +++ b/tools/release/deps.ts @@ -1,4 +1,4 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -export * from "https://raw.githubusercontent.com/denoland/automation/0.11.0/mod.ts"; -export * from "https://raw.githubusercontent.com/denoland/automation/0.11.0/github_actions.ts"; +export * from "https://raw.githubusercontent.com/denoland/automation/0.12.1/mod.ts"; +export * from "https://raw.githubusercontent.com/denoland/automation/0.12.1/github_actions.ts";