Skip to content

Commit 21a9772

Browse files
author
Nicola Lunghi
committed
CI: use targets from docker-bake.hcl
1 parent f67f8ee commit 21a9772

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/CI.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,27 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
jobs:
23+
extract-targets:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
targets: ${{ steps.extract.outputs.targets }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Extract targets as JSON array
30+
id: extract
31+
uses: dcarbone/install-jq-action@v2
32+
- name: Get targets from bake file
33+
id: get-targets
34+
run: |
35+
TARGETS=$(docker buildx bake --file docker-bake.hcl --print | jq -c '[.target | keys[] | select(. != "default")]')
36+
echo "targets=$TARGETS" | tee -a ${GITHUB_OUTPUT}
37+
2338
build:
39+
needs: extract-targets
40+
runs-on: ubuntu-latest
2441
strategy:
2542
matrix:
26-
target: [ "all", "20", "20-alpine", "19", "19-alpine", "18", "18-alpine", "17", "17-alpine", "16", "16-alpine", "15", "14", "13", "12", "11", "10", "9", "8", "7"]
43+
target: ${{ fromJson(needs.extract-targets.outputs.targets) }}
2744
runs-on: ubuntu-latest
2845
steps:
2946
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)