From 1cad859704c13e497323230f06ac69182d831b60 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 16 Sep 2021 03:21:04 -0500 Subject: [PATCH] feat: add setupBrewPack --- src/utils/setup/setupBrewPack.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/utils/setup/setupBrewPack.ts diff --git a/src/utils/setup/setupBrewPack.ts b/src/utils/setup/setupBrewPack.ts new file mode 100644 index 00000000..f2f9675d --- /dev/null +++ b/src/utils/setup/setupBrewPack.ts @@ -0,0 +1,11 @@ +/* eslint-disable require-atomic-updates */ +import { exec } from "@actions/exec" + +/** A function that installs a package using brew */ +export async function setupBrewPack(name: string, version?: string) { + const exit = await exec("brew", ["install", version !== undefined ? `${name}@${version}` : name]) + + if (exit !== 0) { + throw new Error(`Failed to install ${name} ${version}`) + } +}