mirror of
https://github.com/docker/bake-action.git
synced 2025-07-14 12:41:53 +02:00
Allow passing multi-line files
Signed-off-by: Yuanhao Ji <jiyuanhao@apache.org>
This commit is contained in:
28
.github/workflows/ci-subaction.yml
vendored
28
.github/workflows/ci-subaction.yml
vendored
@ -38,9 +38,9 @@ jobs:
|
||||
with:
|
||||
workdir: ./test/group
|
||||
-
|
||||
name: Show matrix
|
||||
name: Show targets
|
||||
run: |
|
||||
echo matrix=${{ steps.gen.outputs.matrix }}
|
||||
echo targets=${{ steps.gen.outputs.targets }}
|
||||
|
||||
list-targets-group-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
@ -56,6 +56,26 @@ jobs:
|
||||
workdir: ./test/group-matrix
|
||||
target: validate
|
||||
-
|
||||
name: Show matrix
|
||||
name: Show targets
|
||||
run: |
|
||||
echo matrix=${{ steps.gen.outputs.matrix }}
|
||||
echo targets=${{ steps.gen.outputs.targets }}
|
||||
|
||||
list-targets-multi-files:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Matrix gen
|
||||
id: gen
|
||||
uses: ./subaction/list-targets
|
||||
with:
|
||||
workdir: ./test/multi-files
|
||||
files: |
|
||||
docker-bake.json
|
||||
docker-bake.hcl
|
||||
-
|
||||
name: Show targets
|
||||
run: |
|
||||
echo targets=${{ steps.gen.outputs.targets }}
|
||||
|
@ -29,7 +29,7 @@ runs:
|
||||
with:
|
||||
script: |
|
||||
let def;
|
||||
const files = `${{ inputs.files }}` ? `${{ inputs.files }}`.split(',') : [];
|
||||
const files = `${{ inputs.files }}` ? `${{ inputs.files }}`.split(/[\r?\n,]+/).filter(Boolean) : [];
|
||||
const target = `${{ inputs.target }}`;
|
||||
|
||||
await core.group(`Validating definition`, async () => {
|
||||
|
15
test/multi-files/docker-bake.hcl
Normal file
15
test/multi-files/docker-bake.hcl
Normal file
@ -0,0 +1,15 @@
|
||||
group "default" {
|
||||
targets = ["t3"]
|
||||
}
|
||||
|
||||
target "t3" {
|
||||
name = "${item.tag}"
|
||||
matrix = {
|
||||
item = t3
|
||||
}
|
||||
args = {
|
||||
VERSION = "${item.version}"
|
||||
DUMMY_ARG = "${item.arg}"
|
||||
}
|
||||
tags = ["${item.tag}"]
|
||||
}
|
14
test/multi-files/docker-bake.json
Normal file
14
test/multi-files/docker-bake.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"t3": [
|
||||
{
|
||||
"version": "v1",
|
||||
"arg": "v1-value",
|
||||
"tag": "v1-tag"
|
||||
},
|
||||
{
|
||||
"version": "v2",
|
||||
"arg": "v2-value",
|
||||
"tag": "v2-tag"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user