Files
common/nuget/nuget/entrypoint.sh
2025-06-24 15:24:16 -07:00

33 lines
930 B
Bash

#!/bin/bash
#TODO: Reweite this action to make use of act/common/mono/mono
function nuget
{
mono /usr/bin/nuget.exe $@
}
if [[ -n "$NUGET_SOURCE_NAME" && -n "$NUGET_SOURCE_URL" && -n "$NUGET_SOURCE_USERNAME" && -n "$NUGET_SOURCE_PASSWORD" ]]; then
nuget source remove -Name "$NUGET_SOURCE_NAME"
nuget source add -Name "$NUGET_SOURCE_NAME" -Source "$NUGET_SOURCE_URL" -Username "$NUGET_SOURCE_USERNAME" -Password "$NUGET_SOURCE_PASSWORD"
SET_SOURCE=true
fi
OUTPUT=$(bash -c "mono /usr/bin/nuget.exe $@")
RESULT=$?
echo "$OUTPUT"
#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
if [[ -n "$SET_SOURCE" ]]; then
nuget source remove -Name "$NUGET_SOURCE_NAME"
fi
if [[ "$CATCH_ERRORS" != "true" ]]; then
exit $RESULT
fi