summaryrefslogtreecommitdiff
path: root/tools/release/03_publish_crates.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-07-19 16:35:58 -0400
committerGitHub <noreply@github.com>2022-07-19 16:35:58 -0400
commit9b4ae0868d5f5a5ef1d49843737f950bbb841cbf (patch)
treeb3c2f77809b8e8f7c556fa413e54be26f0b5a17c /tools/release/03_publish_crates.ts
parent1bdf5a2081b1567ed73d8f85edae53c3f9724e2b (diff)
chore: update deno automation to 0.12 (#15248)
Diffstat (limited to 'tools/release/03_publish_crates.ts')
-rwxr-xr-xtools/release/03_publish_crates.ts35
1 files changed, 6 insertions, 29 deletions
diff --git a/tools/release/03_publish_crates.ts b/tools/release/03_publish_crates.ts
index 0becd3d26..4e149d3b9 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;
-}