mirror of
https://github.com/docker/setup-qemu-action.git
synced 2025-06-14 07:07:13 +02:00
Compare commits
44 Commits
releases/v
...
v2.1.0
Author | SHA1 | Date | |
---|---|---|---|
e81a89b173 | |||
2d3efc7878 | |||
bfc44eaf57 | |||
25725d8d2e | |||
8c1e35a8c6 | |||
f3c51a3313 | |||
c47ad32952 | |||
aa087459ac | |||
9443994984 | |||
81a47e15eb | |||
c5ffa2a617 | |||
b98716c80f | |||
a79c9a847e | |||
4620c11b70 | |||
359ac4c862 | |||
d7a4485e0c | |||
0522dcd2bf | |||
d8ca9c3fab | |||
8b122486ce | |||
466d53193c | |||
607c1922b5 | |||
d7849ecb9c | |||
2d4bfe71c9 | |||
224b802eb3 | |||
95bd865778 | |||
cfd091faa1 | |||
d2a60302b8 | |||
97dc484a91 | |||
10348241d3 | |||
2c05b5fbf4 | |||
3dc90afa6e | |||
6fa95116d3 | |||
2903451da0 | |||
333602ff38 | |||
cc4c677222 | |||
ae6b230d57 | |||
c1d9b8c4b2 | |||
233328c4da | |||
4259ef6ecb | |||
821c6666b8 | |||
951089ad06 | |||
5ef7a3eebb | |||
efd685dd84 | |||
07f9c084d6 |
20
.eslintrc.json
Normal file
20
.eslintrc.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:prettier/recommended"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint",
|
||||||
|
"prettier"
|
||||||
|
]
|
||||||
|
}
|
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@ -4,19 +4,15 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "06:00"
|
|
||||||
timezone: "Europe/Paris"
|
|
||||||
labels:
|
labels:
|
||||||
- ":game_die: dependencies"
|
- "dependencies"
|
||||||
- ":robot: bot"
|
- "bot"
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
time: "06:00"
|
|
||||||
timezone: "Europe/Paris"
|
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
labels:
|
labels:
|
||||||
- ":game_die: dependencies"
|
- "dependencies"
|
||||||
- ":robot: bot"
|
- "bot"
|
||||||
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
id: qemu
|
id: qemu
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Stop docker
|
name: Stop docker
|
||||||
run: |
|
run: |
|
||||||
|
4
.github/workflows/validate.yml
vendored
4
.github/workflows/validate.yml
vendored
@ -16,9 +16,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v1
|
uses: docker/bake-action@v2
|
||||||
with:
|
with:
|
||||||
targets: validate
|
targets: validate
|
||||||
|
40
README.md
40
README.md
@ -13,7 +13,8 @@ ___
|
|||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
* [outputs](#outputs)
|
||||||
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -27,19 +28,9 @@ jobs:
|
|||||||
qemu:
|
qemu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
id: qemu
|
uses: docker/setup-qemu-action@v2
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
with:
|
|
||||||
image: tonistiigi/binfmt:latest
|
|
||||||
platforms: all
|
|
||||||
-
|
|
||||||
name: Available platforms
|
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
@ -48,10 +39,10 @@ jobs:
|
|||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|------------------|---------|------------------------------------|
|
|-------------|--------|---------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
|
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
|
||||||
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
|
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
@ -61,18 +52,7 @@ Following outputs are available
|
|||||||
|---------------|---------|---------------------------------------|
|
|---------------|---------|---------------------------------------|
|
||||||
| `platforms` | String | Available platforms (comma separated) |
|
| `platforms` | String | Available platforms (comma separated) |
|
||||||
|
|
||||||
## Keep up-to-date with GitHub Dependabot
|
## Contributing
|
||||||
|
|
||||||
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
|
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
|
||||||
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
# Maintain dependencies for GitHub Actions
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
```
|
|
||||||
|
@ -21,5 +21,5 @@ outputs:
|
|||||||
description: 'Available platforms (comma separated)'
|
description: 'Available platforms (comma separated)'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1.2
|
# syntax=docker/dockerfile:1
|
||||||
ARG NODE_VERSION
|
|
||||||
|
ARG NODE_VERSION=16
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
RUN apk add --no-cache cpio findutils git
|
RUN apk add --no-cache cpio findutils git
|
||||||
@ -8,7 +9,22 @@ WORKDIR /src
|
|||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn install
|
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
||||||
|
|
||||||
|
FROM scratch AS vendor-update
|
||||||
|
COPY --from=deps /vendor /
|
||||||
|
|
||||||
|
FROM deps AS vendor-validate
|
||||||
|
RUN --mount=type=bind,target=.,rw <<EOT
|
||||||
|
set -e
|
||||||
|
git add -A
|
||||||
|
cp -rf /vendor/* .
|
||||||
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
||||||
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
|
||||||
|
git status --porcelain -- yarn.lock
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
@ -19,13 +35,16 @@ FROM scratch AS build-update
|
|||||||
COPY --from=build /out /
|
COPY --from=build /out /
|
||||||
|
|
||||||
FROM build AS build-validate
|
FROM build AS build-validate
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw <<EOT
|
||||||
git add -A && cp -rf /out/* .; \
|
set -e
|
||||||
if [ -n "$(git status --porcelain -- dist)" ]; then \
|
git add -A
|
||||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'; \
|
cp -rf /out/* .
|
||||||
git status --porcelain -- dist; \
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
exit 1; \
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
||||||
fi
|
git status --porcelain -- dist
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
EOT
|
||||||
|
|
||||||
FROM deps AS format
|
FROM deps AS format
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
@ -36,7 +55,7 @@ RUN --mount=type=bind,target=.,rw \
|
|||||||
FROM scratch AS format-update
|
FROM scratch AS format-update
|
||||||
COPY --from=format /out /
|
COPY --from=format /out /
|
||||||
|
|
||||||
FROM deps AS format-validate
|
FROM deps AS lint
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run format-check \
|
yarn run lint
|
1864
dist/index.js
generated
vendored
1864
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/index.js.map
generated
vendored
Normal file
1
dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
88
dist/licenses.txt
generated
vendored
Normal file
88
dist/licenses.txt
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
@actions/core
|
||||||
|
MIT
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
@actions/exec
|
||||||
|
MIT
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
@actions/http-client
|
||||||
|
MIT
|
||||||
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
Copyright (c) GitHub, Inc.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
@actions/io
|
||||||
|
MIT
|
||||||
|
|
||||||
|
tunnel
|
||||||
|
MIT
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2012 Koichi Kobayashi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
uuid
|
||||||
|
MIT
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
dist/sourcemap-register.js
generated
vendored
Normal file
1
dist/sourcemap-register.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,13 +1,3 @@
|
|||||||
variable "NODE_VERSION" {
|
|
||||||
default = "12"
|
|
||||||
}
|
|
||||||
|
|
||||||
target "node-version" {
|
|
||||||
args = {
|
|
||||||
NODE_VERSION = NODE_VERSION
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["build"]
|
targets = ["build"]
|
||||||
}
|
}
|
||||||
@ -17,44 +7,41 @@ group "pre-checkin" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
targets = ["format-validate", "build-validate", "vendor-validate"]
|
targets = ["lint", "build-validate", "vendor-validate"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
inherits = ["node-version"]
|
dockerfile = "dev.Dockerfile"
|
||||||
dockerfile = "./hack/build.Dockerfile"
|
|
||||||
target = "build-update"
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build-validate" {
|
target "build-validate" {
|
||||||
inherits = ["node-version"]
|
dockerfile = "dev.Dockerfile"
|
||||||
dockerfile = "./hack/build.Dockerfile"
|
|
||||||
target = "build-validate"
|
target = "build-validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
inherits = ["node-version"]
|
dockerfile = "dev.Dockerfile"
|
||||||
dockerfile = "./hack/build.Dockerfile"
|
|
||||||
target = "format-update"
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format-validate" {
|
target "lint" {
|
||||||
inherits = ["node-version"]
|
dockerfile = "dev.Dockerfile"
|
||||||
dockerfile = "./hack/build.Dockerfile"
|
target = "lint"
|
||||||
target = "format-validate"
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-update" {
|
target "vendor-update" {
|
||||||
inherits = ["node-version"]
|
dockerfile = "dev.Dockerfile"
|
||||||
dockerfile = "./hack/vendor.Dockerfile"
|
target = "vendor-update"
|
||||||
target = "update"
|
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-validate" {
|
target "vendor-validate" {
|
||||||
inherits = ["node-version"]
|
dockerfile = "dev.Dockerfile"
|
||||||
dockerfile = "./hack/vendor.Dockerfile"
|
target = "vendor-validate"
|
||||||
target = "validate"
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1.2
|
|
||||||
ARG NODE_VERSION
|
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
|
||||||
RUN apk add --no-cache git
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
FROM base AS vendored
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn install && mkdir /out && cp yarn.lock /out
|
|
||||||
|
|
||||||
FROM scratch AS update
|
|
||||||
COPY --from=vendored /out /
|
|
||||||
|
|
||||||
FROM vendored AS validate
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
git add -A && cp -rf /out/* .; \
|
|
||||||
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then \
|
|
||||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'; \
|
|
||||||
git status --porcelain -- yarn.lock; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
27
package.json
27
package.json
@ -3,10 +3,10 @@
|
|||||||
"description": "Install QEMU static binaries",
|
"description": "Install QEMU static binaries",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && ncc build",
|
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
||||||
"format": "prettier --write **/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format": "eslint --fix src/**/*.ts",
|
||||||
"pre-checkin": "yarn run format && yarn run build"
|
"all": "yarn run build && yarn run format"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -26,14 +26,19 @@
|
|||||||
],
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.3.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.4"
|
"@actions/exec": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^14.0.14",
|
"@types/node": "^16.11.26",
|
||||||
"@vercel/ncc": "^0.23.0",
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||||
"prettier": "^2.0.5",
|
"@typescript-eslint/parser": "^5.14.0",
|
||||||
"typescript": "^3.9.5",
|
"@vercel/ncc": "^0.33.3",
|
||||||
"typescript-formatter": "^7.2.2"
|
"eslint": "^8.11.0",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
|
"prettier": "^2.3.1",
|
||||||
|
"ts-node": "^10.7.0",
|
||||||
|
"typescript": "^4.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
src/context.ts
Normal file
13
src/context.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
export interface Inputs {
|
||||||
|
image: string;
|
||||||
|
platforms: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getInputs(): Inputs {
|
||||||
|
return {
|
||||||
|
image: core.getInput('image') || 'tonistiigi/binfmt:latest',
|
||||||
|
platforms: core.getInput('platforms') || 'all'
|
||||||
|
};
|
||||||
|
}
|
34
src/exec.ts
34
src/exec.ts
@ -1,34 +0,0 @@
|
|||||||
import * as actionsExec from '@actions/exec';
|
|
||||||
import {ExecOptions} from '@actions/exec';
|
|
||||||
|
|
||||||
export interface ExecResult {
|
|
||||||
success: boolean;
|
|
||||||
stdout: string;
|
|
||||||
stderr: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const exec = async (command: string, args: string[] = [], silent: boolean): Promise<ExecResult> => {
|
|
||||||
let stdout: string = '';
|
|
||||||
let stderr: string = '';
|
|
||||||
|
|
||||||
const options: ExecOptions = {
|
|
||||||
silent: silent,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
};
|
|
||||||
options.listeners = {
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
stdout += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data: Buffer) => {
|
|
||||||
stderr += data.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const returnCode: number = await actionsExec.exec(command, args, options);
|
|
||||||
|
|
||||||
return {
|
|
||||||
success: returnCode === 0,
|
|
||||||
stdout: stdout.trim(),
|
|
||||||
stderr: stderr.trim()
|
|
||||||
};
|
|
||||||
};
|
|
72
src/main.ts
72
src/main.ts
@ -1,7 +1,6 @@
|
|||||||
import * as mexec from './exec';
|
import * as context from './context';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import {issueCommand} from '@actions/core/lib/command';
|
|
||||||
|
|
||||||
interface Platforms {
|
interface Platforms {
|
||||||
supported: string[];
|
supported: string[];
|
||||||
@ -10,44 +9,47 @@ interface Platforms {
|
|||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
core.startGroup(`Docker info`);
|
const input: context.Inputs = context.getInputs();
|
||||||
await exec.exec('docker', ['version']);
|
|
||||||
await exec.exec('docker', ['info']);
|
|
||||||
core.endGroup();
|
|
||||||
|
|
||||||
const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest';
|
await core.group(`Docker info`, async () => {
|
||||||
const platforms: string = core.getInput('platforms') || 'all';
|
await exec.exec('docker', ['version'], {
|
||||||
|
failOnStdErr: false
|
||||||
core.startGroup(`Pulling binfmt Docker image`);
|
});
|
||||||
await exec.exec('docker', ['pull', image]);
|
await exec.exec('docker', ['info'], {
|
||||||
core.endGroup();
|
failOnStdErr: false
|
||||||
|
});
|
||||||
core.startGroup(`Image info`);
|
});
|
||||||
await exec.exec('docker', ['image', 'inspect', image]);
|
|
||||||
core.endGroup();
|
await core.group(`Pulling binfmt Docker image`, async () => {
|
||||||
|
await exec.exec('docker', ['pull', input.image]);
|
||||||
core.startGroup(`Installing QEMU static binaries`);
|
});
|
||||||
await exec.exec('docker', ['run', '--rm', '--privileged', image, '--install', platforms]);
|
|
||||||
core.endGroup();
|
await core.group(`Image info`, async () => {
|
||||||
|
await exec.exec('docker', ['image', 'inspect', input.image]);
|
||||||
core.startGroup(`Extracting available platforms`);
|
});
|
||||||
await mexec.exec(`docker`, ['run', '--rm', '--privileged', image], true).then(res => {
|
|
||||||
if (res.stderr != '' && !res.success) {
|
await core.group(`Installing QEMU static binaries`, async () => {
|
||||||
throw new Error(res.stderr);
|
await exec.exec('docker', ['run', '--rm', '--privileged', input.image, '--install', input.platforms]);
|
||||||
}
|
});
|
||||||
const platforms: Platforms = JSON.parse(res.stdout.trim());
|
|
||||||
core.info(`${platforms.supported.join(',')}`);
|
await core.group(`Extracting available platforms`, async () => {
|
||||||
setOutput('platforms', platforms.supported.join(','));
|
await exec
|
||||||
|
.getExecOutput('docker', ['run', '--rm', '--privileged', input.image], {
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
silent: true
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||||
|
throw new Error(res.stderr.trim());
|
||||||
|
}
|
||||||
|
const platforms: Platforms = JSON.parse(res.stdout.trim());
|
||||||
|
core.info(`${platforms.supported.join(',')}`);
|
||||||
|
core.setOutput('platforms', platforms.supported.join(','));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
core.endGroup();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
|
|
||||||
function setOutput(name: string, value: any): void {
|
|
||||||
issueCommand('set-output', {name}, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
@ -2,17 +2,16 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"lib": [
|
|
||||||
"es6",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"esModuleInterop": true,
|
"useUnknownInCatchVariables": false,
|
||||||
"sourceMap": true
|
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user