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}`) + } +}