mirror of https://github.com/aminya/setup-cpp
feat: add setup apt
This commit is contained in:
parent
de191063e3
commit
cd0ee64e3e
|
@ -0,0 +1,14 @@
|
|||
import { exec } from "@actions/exec"
|
||||
|
||||
/** A function that installs a package using apt */
|
||||
export async function setupApt(name: string, version?: string, updateRepositories: boolean = true) {
|
||||
if (updateRepositories) {
|
||||
await exec("apt-get", ["update"])
|
||||
}
|
||||
|
||||
const exit = await exec("apt-get", ["install", version !== undefined ? `${name}=${version}` : name])
|
||||
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to install ${name} ${version}`)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue