mirror of https://github.com/aminya/setup-cpp
perf: cache apt-get update
This commit is contained in:
parent
064da1045c
commit
9e16dda2d6
|
@ -1,9 +1,13 @@
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
import { exec } from "@actions/exec"
|
import { exec } from "@actions/exec"
|
||||||
|
|
||||||
|
let didUpdate: boolean = false
|
||||||
|
|
||||||
/** A function that installs a package using apt */
|
/** A function that installs a package using apt */
|
||||||
export async function setupAptPack(name: string, version?: string, updateRepositories: boolean = true) {
|
export async function setupAptPack(name: string, version?: string, updateRepositories: boolean = true) {
|
||||||
if (updateRepositories) {
|
if (!didUpdate || updateRepositories) {
|
||||||
await exec("apt-get", ["update"])
|
await exec("apt-get", ["update"])
|
||||||
|
didUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const exit = await exec("apt-get", ["install", version !== undefined ? `${name}=${version}` : name])
|
const exit = await exec("apt-get", ["install", version !== undefined ? `${name}=${version}` : name])
|
||||||
|
|
Loading…
Reference in New Issue