fix(ci): Wait exec asynchronously (#5547)

This commit is contained in:
OJ Kwon 2022-08-17 22:08:52 -07:00 committed by GitHub
parent a090c787cf
commit 719444c42c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,9 @@
import { exec } from "child_process";
import { getTitleOfLatestCommit } from "../util/git";
import { parsePrComments } from "./comment-parser";
import { promisify } from "util";
const execAsync = promisify(exec);
(async () => {
const latestCommitMessage = await getTitleOfLatestCommit();
@ -33,9 +36,9 @@ import { parsePrComments } from "./comment-parser";
console.log(action);
if (action.breaking) {
await exec(`cargo mono bump ${action.crate} --breaking`);
await execAsync(`cargo mono bump ${action.crate} --breaking`);
} else {
await exec(`cargo mono bump ${action.crate}`);
await execAsync(`cargo mono bump ${action.crate}`);
}
}
})();

View File

@ -4,6 +4,8 @@ import * as fs from "fs";
import { promisify } from "util";
import * as path from "path";
const execAsync = promisify(exec);
const writeFile = promisify(fs.writeFile);
(async () => {
@ -21,6 +23,6 @@ pub(crate) static GIT_SHA: &str = "${sha}";`,
);
// we won't push, it's only to avoid dirty check for the publish
exec(`git add ${filePath}`);
exec(`git commit -m build(swc/core): bump sha`);
await execAsync(`git add ${filePath}`);
await execAsync(`git commit -m build(swc/core): bump sha`);
})();