forked from browser-actions/setup-chrome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
install-dependencies
parameter (browser-actions#521)
A new parameter `install-dependencies` is added to the action. The action will install the dependencies if the parameter is set to `true` on the Linux. It would be useful when you use the action on the self-hosted runner and want to install the dependencies automatically. This feature works only on the Linux runner, otherwise, it will be ignored.
- Loading branch information
Showing
8 changed files
with
170 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { pkg, runtime } from "actions-swing"; | ||
import type { Platform } from "./platform"; | ||
import * as core from "@actions/core"; | ||
|
||
const DEBIAN_BASED_DEPENDENT_PACKAGES = [ | ||
"libglib2.0-0", | ||
"libgconf-2-4", | ||
"libatk1.0-0", | ||
"libatk-bridge2.0-0", | ||
"libgdk-pixbuf2.0-0", | ||
"libgtk-3-0", | ||
"libgbm-dev", | ||
"libnss3-dev", | ||
"libxss-dev", | ||
"libasound2", | ||
"xvfb", | ||
"fonts-liberation", | ||
"libu2f-udev", | ||
"xdg-utils", | ||
]; | ||
|
||
const FEDORA_BASED_DEPENDENT_PACKAGES = [ | ||
"alsa-lib", | ||
"atk", | ||
"at-spi2-atk", | ||
"cups-libs", | ||
"libdrm", | ||
"libXcomposite", | ||
"libXdamage", | ||
"libxkbcommon", | ||
"libXrandr", | ||
"mesa-libgbm", | ||
"nss", | ||
"pango", | ||
]; | ||
|
||
const SUSE_BASED_DEPENDENT_PACKAGES = [ | ||
"libasound2", | ||
"libatk-1_0-0", | ||
"libatk-bridge-2_0-0", | ||
"libcups2", | ||
"libdbus-1-3", | ||
"libdrm2", | ||
"libgbm1", | ||
"libgobject-2_0-0", | ||
"libpango-1_0-0", | ||
"libXcomposite1", | ||
"libXdamage1", | ||
"libXfixes3", | ||
"libxkbcommon0", | ||
"libXrandr2", | ||
"mozilla-nss", | ||
]; | ||
|
||
const installDependencies = async (platform: Platform): Promise<void> => { | ||
if (platform.os !== "linux") { | ||
core.warning( | ||
`install-dependencies is only supported on Linux, but current platform is ${platform.os}`, | ||
); | ||
return; | ||
} | ||
|
||
const packages = await (async () => { | ||
const osReleaseId = await runtime.getOsReleaseId(); | ||
switch (osReleaseId) { | ||
case "rhel": | ||
case "centos": | ||
case "ol": | ||
case "fedora": | ||
return FEDORA_BASED_DEPENDENT_PACKAGES; | ||
case "debian": | ||
case "ubuntu": | ||
case "linuxmint": | ||
return DEBIAN_BASED_DEPENDENT_PACKAGES; | ||
case "opensuse": | ||
case "opensuse-leap": | ||
case "sles": | ||
return SUSE_BASED_DEPENDENT_PACKAGES; | ||
} | ||
throw new Error(`Unsupported OS: ${osReleaseId}`); | ||
})(); | ||
|
||
await pkg.install(packages); | ||
}; | ||
|
||
export { installDependencies }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters