ci: fix ccm build when no new version are found

Previous output of findvers.sh would be [""] in case no version were
found, now the output is []. Also, GitHub cannot handle empty arrays
in the matrix field, so we add an if and check if the array is empty.

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-08-23 11:42:16 +02:00
parent 47fc676927
commit abd5cdf362
2 changed files with 4 additions and 1 deletions

View File

@ -81,4 +81,5 @@ for major in "${allMajorVersions[@]}"; do
versionsToBuild+=("${latest}")
done
printf '%s\n' "${versionsToBuild[@]}" | jq -R | jq -sc
# Print one elem per line | quote elems | create array | remove empty elems and print compact.
printf '%s' "${versionsToBuild[@]}" | jq -R | jq -s | jq -c 'map(select(length > 0))'

View File

@ -52,6 +52,8 @@ jobs:
echo "latest=${lastest}" | tee -a "$GITHUB_OUTPUT"
build-ccm-gcp:
# matrix cannot handle empty lists
if: needs.find-ccm-versions.outputs.versions != '[]'
runs-on: ubuntu-22.04
permissions:
contents: read