Improve upgrade script
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -2,6 +2,7 @@ import { Colors, Path, FS, Compress, Base64 } from "../deps.ts";
|
||||
import { getMeta, IMeta, log, getConfig } from "../global.ts";
|
||||
import { runHooks } from "../helper/run_script.ts";
|
||||
import { ServerError } from "../helper/server_error.ts";
|
||||
import { checkPermOrExit } from "../helper/permission.ts";
|
||||
|
||||
export default async function publish(options: { dry: boolean }) {
|
||||
const originalMeta = await getMeta();
|
||||
@ -62,6 +63,8 @@ export default async function publish(options: { dry: boolean }) {
|
||||
);
|
||||
|
||||
if (!options.dry) {
|
||||
await checkPermOrExit("net", "Net permission required for publishing");
|
||||
|
||||
log("Uploading new package version");
|
||||
await fetch(url, {
|
||||
method: "POST",
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { Cliffy, Colors } from "../deps.ts";
|
||||
import { version } from "../version.ts";
|
||||
import { requestPermOrExit } from "../helper/permission.ts";
|
||||
|
||||
export default async function upgrade() {
|
||||
await requestPermOrExit(
|
||||
"net",
|
||||
"Net permission required to fetch new version"
|
||||
);
|
||||
const meta = await fetch(
|
||||
"https://deno.hibas123.de/raw/@denreg-cli/meta.json"
|
||||
).then((e) => e.json());
|
||||
@ -20,15 +25,23 @@ export default async function upgrade() {
|
||||
});
|
||||
|
||||
if (res) {
|
||||
const cmd = [
|
||||
"deno",
|
||||
"install",
|
||||
"-A",
|
||||
"--unstable",
|
||||
"-f",
|
||||
`https://deno.hibas123.de/raw/@denreg-cli@${meta.version}/denreg.ts`,
|
||||
];
|
||||
|
||||
await requestPermOrExit(
|
||||
"run",
|
||||
"Run permission required to install new version. Or run it manually: " +
|
||||
cmd.join(" ")
|
||||
);
|
||||
|
||||
const process = Deno.run({
|
||||
cmd: [
|
||||
"deno",
|
||||
"install",
|
||||
"-A",
|
||||
"--unstable",
|
||||
"-f",
|
||||
`https://deno.hibas123.de/raw/@denreg-cli@${meta.version}/denreg.ts`,
|
||||
],
|
||||
cmd,
|
||||
});
|
||||
|
||||
const s = await process.status();
|
||||
|
Reference in New Issue
Block a user