Adding installation of skopeo

Since other platforms, beside Github Actions, can use Actions
(see https://forgejo.org/docs/v1.21/user/actions/), it is not save to assume
skopeo is installed by default.
This commit is contained in:
Jan Wagner 2024-01-04 19:36:01 +01:00
parent 6e419dd17b
commit 2754bd63e5

16
main.js
View file

@ -16,9 +16,25 @@ function getImageTag(imageName, distribution) {
} }
async function getImageName(distribution) { async function getImageName(distribution) {
const io = require('@actions/io')
const tag = getImageTag("", distribution) const tag = getImageTag("", distribution)
for (const image of ["debian", "ubuntu"]) { for (const image of ["debian", "ubuntu"]) {
try { try {
const skopeoPath = await io.which('skopeo', true)
if (!skopeoPath) {
core.startGroup("Install skopeo")
await exec.exec("sudo", [
"apt-get",
"update"
])
await exec.exec("sudo", [
"apt-get",
"-y",
"install",
"skopeo"
])
core.endGroup()
}
core.startGroup("Get image name") core.startGroup("Get image name")
await exec.exec("skopeo", [ await exec.exec("skopeo", [
"inspect", "inspect",