Files
common/itchio/butler/entrypoint.sh
2023-04-30 22:38:19 -07:00

22 lines
450 B
Bash

#!/bin/bash
ARGS="$@"
set -o pipefail
exec 5>&1
OUTPUT=$(bash -c "butler $ARGS" | tee /dev/fd/5)
RESULT=$?
#Output multiline strings.
#https://trstringer.com/github-actions-multiline-strings/
if [[ -n "$OUTPUT" ]]; then
echo "console<<EOF" >> "$GITHUB_OUTPUT"
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
if [[ "$CATCH_ERRORS" != "true" ]]; then
exit $RESULT
fi