Files
common/dotnet/dotnet-10/entrypoint.sh
2025-07-07 20:58:04 -07:00

37 lines
835 B
Bash

#!/bin/bash
source nuget_utils.sh
COMMAND="$@"
set -o pipefail
# Add root tools to Path.
export PATH="$PATH:/root/.dotnet/tools/"
# Define a local application data folder.
export XDG_DATA_HOME="$HOME/.local/share"
mkdir -p "$XDG_DATA_HOME"
PROGRAM=${PROGRAM:-"dotnet"}
exec 5>&1
OUTPUT=$(bash -c "$PROGRAM $COMMAND" | 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
# Add NuGet sources before running command
handle_nuget_sources "add"
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
# Remove NuGet sources after running command
handle_nuget_sources "remove"
if [[ "$CATCH_ERRORS" != "true" ]]; then
exit $RESULT
fi