Added many, many more actions.

This commit is contained in:
2025-06-24 15:24:16 -07:00
parent 62fbe4dead
commit 57ef232d2b
108 changed files with 4212 additions and 7 deletions

View File

@@ -0,0 +1,38 @@
name: dotnet-nugetforunity-restore
description: "Restore NugetForUnity packages."
inputs:
projectPath:
description: "Path to the Unity project."
required: true
default: "."
restoreMode:
description: "Whether or not to resture NuGetForUnity packages. Options: true, false, auto"
required: true
default: auto
runs:
using: "composite"
steps:
- name: "Determine if NuGet packages need restored."
id: nuget
run: |
NUGET="${{ inputs.restoreMode }}"
if [ "$NUGET" == "auto" ]; then
if [ -f "${{ inputs.projectPath }}/Assets/NuGet.config" ]; then
NUGET=true
else
NUGET=false
fi
fi
echo "restoreMode=$NUGET" >> "$GITHUB_OUTPUT"
shell: bash
- name: "Restore NuGet packages."
if: ${{ steps.nuget.outputs.restoreMode == 'true' }}
uses: act/common/dotnet/dotnet@master
with:
program: nugetforunity
command: restore "${{ inputs.projectPath }}"
- name: "Own artifacts."
if: ${{ steps.nuget.outputs.restoreMode == 'true' }}
uses: act/common/utils/chown@master
with:
file: ${{ inputs.projectPath }}/Assets/Packages

View File

@@ -0,0 +1,24 @@
name: dotnet-push
description: "Push a nuget package with dotnet."
inputs:
nupkg:
description: "Path to the .nupkg to push."
required: true
url:
description: "URL of the nuget repository to push to."
required: true
default: ${{ github.server_url }}/_registry/nuget/${{ github.repository_owner }}/index.json
apiKey:
description: "ApiKey of the nuget repository to push to."
required: true
default: ${{ github.token }}
options:
description: "Additional options when pushing the .nupkg."
required: false
runs:
using: "composite"
steps:
- name: "Push the NuGet package."
uses: act/common/dotnet/dotnet@master
with:
command: nuget push ${{ inputs.nupkg }} -s ${{ inputs.url }} -k ${{ inputs.apiKey }} ${{ inputs.options }}

14
dotnet/dotnet/Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
ARG VERSION=7.0
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"]

21
dotnet/dotnet/action.yaml Normal file
View File

@@ -0,0 +1,21 @@
name: dotnet
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