This commit is contained in:
2025-06-30 00:58:23 -07:00
parent c7de24644f
commit 5feab19890
5 changed files with 110 additions and 5 deletions

View File

@@ -0,0 +1,14 @@
ARG VERSION=10.0.100-preview.5
FROM mcr.microsoft.com/dotnet/sdk:$VERSION
RUN apt update
RUN apt install curl -y
# Add tools to Path.
RUN echo 'export PATH="$PATH:$HOME/.dotnet/tools/"' | tee -a "$HOME/.bashrc" > /dev/null
# Install NugetForUnity tool: https://github.com/GlitchEnzo/NuGetForUnity
RUN dotnet tool install --global NuGetForUnity.Cli
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -0,0 +1,21 @@
name: dotnet-10
description: "Run a dotnet command."
inputs:
command:
description: "Dotnet command to run."
required: false
program:
description: "Program to run instead of dotnet. Default: dotnet"
required: false
default: "dotnet"
catchErrors:
description: "Whether or not errors should be handled."
required: false
runs:
env:
PROGRAM: ${{ inputs.program }}
CATCH_ERRORS: ${{ inputs.catchErrors }}
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.command }}

View File

@@ -0,0 +1,25 @@
#!/bin/bash
COMMAND="$@"
set -o pipefail
# Add root tools to Path.
export PATH="$PATH:/root/.dotnet/tools/"
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
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
if [[ "$CATCH_ERRORS" != "true" ]]; then
exit $RESULT
fi