Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Improve Ubuntu version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
cptpcrd committed Nov 26, 2020
1 parent b465142 commit 05f8a08
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ function getRunner(): string {
case "darwin":
return "macos-10.15";
case "linux":
// TODO: Is there better way to determine Actions runner OS?
if (os.release().startsWith("4.15")) {
return "ubuntu-16.04";
} else {
return "ubuntu-18.04";
for (const line of require("fs")
.readFileSync("/etc/os-release", {
encoding: "utf8",
})
.split("\n")) {
if (line.startsWith("VERSION_ID=")) {
return "ubuntu-" + line.substring(10).replaceAll(/"/g, "");
}
}

throw new Error("Unrecognized version of Ubuntu");
default:
throw new Error("Unsupported OS");
}
Expand Down

0 comments on commit 05f8a08

Please sign in to comment.