mirror of
https://github.com/denoland/deno.git
synced 2025-09-24 19:32:30 +00:00
build: use workflows for bumping versions and cargo publishing on the CI (#13995)
This commit is contained in:
parent
f61b2c0b11
commit
5cab3e7dba
13 changed files with 306 additions and 74 deletions
48
tools/release/03_publish_crates.ts
Executable file
48
tools/release/03_publish_crates.ts
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo --allow-net=crates.io --no-check
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import { DenoWorkspace } from "./deno_workspace.ts";
|
||||
import { Crate, getCratesPublishOrder } from "./deps.ts";
|
||||
|
||||
const isReal = parseIsReal();
|
||||
console.log(`Running a ${isReal ? "real" : "dry"} cargo publish...`);
|
||||
|
||||
const workspace = await DenoWorkspace.load();
|
||||
const cliCrate = workspace.getCliCrate();
|
||||
|
||||
const dependencyCrates = getCratesPublishOrder(
|
||||
workspace.getCliDependencyCrates(),
|
||||
);
|
||||
|
||||
try {
|
||||
for (const [i, crate] of dependencyCrates.entries()) {
|
||||
await publishCrate(crate);
|
||||
console.log(`Finished ${i + 1} of ${dependencyCrates.length} crates.`);
|
||||
}
|
||||
|
||||
await publishCrate(cliCrate);
|
||||
} 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue