Fixed the bash-while-subshell problem

This commit is contained in:
Thorsten Sommer 2024-06-16 13:22:52 +02:00
parent 308e27b981
commit dfe06c0747
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -441,11 +441,17 @@ jobs:
FORMATTED_VERSION: ${{ needs.read_metadata.outputs.formatted_version }} FORMATTED_VERSION: ${{ needs.read_metadata.outputs.formatted_version }}
run: | run: |
# Export the necessary variables for xargs:
export GITHUB_WORKSPACE
export FORMATTED_VERSION
export platforms_json
# Here, we create the JSON object: # Here, we create the JSON object:
platforms_json=$(jq -n '{}') platforms_json=$(jq -n '{}')
# Iterate over all signature files: # Function to process each signature file
find $GITHUB_WORKSPACE/artifacts -type f -name '*.sig' -print0 | while IFS= read -r -d '' sig_file; do process_signature() {
sig_file="$1"
echo "Processing signature file '$sig_file':" echo "Processing signature file '$sig_file':"
@ -482,8 +488,13 @@ jobs:
else else
echo " Error: Could not find the platform file for the signature file '$sig_file'." echo " Error: Could not find the platform file for the signature file '$sig_file'."
fi fi
done }
# Export the function to make it available to xargs:
export -f process_signature
# Iterate over all signature files using find and xargs:
find $GITHUB_WORKSPACE/artifacts -type f -name '*.sig' -print0 | xargs -0 -I {} bash -c 'process_signature "$@"' _ {}
echo "Platforms JSON: '$platforms_json'" echo "Platforms JSON: '$platforms_json'"
# Write the JSON object to a temporary file: # Write the JSON object to a temporary file: