File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Get Container Platforms
2+ description : ' Extracts supported platforms from a Docker image manifest'
3+ inputs :
4+ image :
5+ description : ' Image name to inspect'
6+ required : true
7+ outputs :
8+ platforms :
9+ description : ' Comma-separated list of platforms'
10+ value : ${{ steps.set-env.outputs.platforms }}
11+ build-matrix :
12+ description : ' JSON array of platforms'
13+ value : ${{ steps.set-env.outputs.build-matrix }}
14+
15+ runs :
16+ using : ' composite'
17+ steps :
18+ - name : Set dynamic environment
19+ id : set-env
20+ run : |
21+ PLATFORMS="$(docker manifest inspect ${{ inputs.image }} | \
22+ jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
23+ sort -u | grep -v unknown | paste -sd ',')"
24+ BUILD_MATRIX="$(echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' ')"
25+ echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
26+ echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT
27+ shell : bash
You can’t perform that action at this time.
0 commit comments