117 lines
4.0 KiB
YAML
117 lines
4.0 KiB
YAML
name: "Setup Godot"
|
|
description: "This GitHub Action automates the setup of Godot"
|
|
author: Mike Schulze <mikeschulze.lpz@gmail.com>
|
|
|
|
inputs:
|
|
godot-version:
|
|
description: "The version of Godot in which the tests should be run."
|
|
required: true
|
|
godot-status:
|
|
description: 'The Godot status (e.g., "stable", "rc1", "dev1")'
|
|
required: false
|
|
default: "stable"
|
|
dotnet-version:
|
|
description: 'The used .NET version to run the test (e.g. "net7.0", "net8.0")'
|
|
required: false
|
|
default: net8.0
|
|
project_dir:
|
|
description: "The project directory in which the action is to be executed. The specified directory must end with a path separator. e.g. ./MyProject/"
|
|
required: false
|
|
default: "./"
|
|
install-path:
|
|
description: "Install path of the Godot executable"
|
|
required: false
|
|
default: "/home/runner/godot-linux"
|
|
|
|
outputs:
|
|
godot_bin:
|
|
description: "The location of the godot executable"
|
|
value: /home/runner/godot-linux/godot
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: "Set Cache Name"
|
|
shell: bash
|
|
run: |
|
|
echo "CACHE_NAME=${{ runner.OS }}-Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status }}-${{ inputs.dotnet-version }}" >> "$GITHUB_ENV"
|
|
|
|
- name: "Build Cache"
|
|
uses: actions/cache@v5
|
|
id: godot-cache-binary
|
|
with:
|
|
path: ${{ inputs.install-path }}
|
|
key: ${{ env.CACHE_NAME }}
|
|
restore-keys: ${{ env.CACHE_NAME }}
|
|
enableCrossOsArchive: true
|
|
|
|
- name: "Download and Install Godot ${{ inputs.godot-version }}-${{ inputs.godot-status }}"
|
|
if: steps.godot-cache-binary.outputs.cache-hit != 'true'
|
|
continue-on-error: false
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ${{ inputs.install-path }}
|
|
chmod 770 ${{ inputs.install-path }}
|
|
DIR="$HOME/.config/godot"
|
|
if [ ! -d "$DIR" ]; then
|
|
mkdir -p "$DIR"
|
|
chmod 770 "$DIR"
|
|
fi
|
|
|
|
DOWNLOAD_URL=https://github.com/godotengine/godot-builds/releases/download/${{ inputs.godot-version }}-${{ inputs.godot-status }}
|
|
GODOT_BIN=Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status }}_mono_linux_x86_64
|
|
|
|
GODOT_PACKAGE=$GODOT_BIN.zip
|
|
echo "Download URL: $DOWNLOAD_URL/$GODOT_PACKAGE"
|
|
wget --progress=bar:force:noscroll $DOWNLOAD_URL/$GODOT_PACKAGE -P ${{ inputs.install-path }}
|
|
unzip ${{ inputs.install-path }}/$GODOT_PACKAGE -d ${{ inputs.install-path }}
|
|
rm -rf ${{ inputs.install-path }}/$GODOT_PACKAGE
|
|
|
|
echo "Run linux part"
|
|
mv ${{ inputs.install-path }}/$GODOT_BIN/* ${{ inputs.install-path }}
|
|
rmdir ${{ inputs.install-path }}/$GODOT_BIN/
|
|
|
|
mv ${{ inputs.install-path }}/Godot_v* ${{ inputs.install-path }}/godot
|
|
chmod u+x ${{ inputs.install-path }}/godot
|
|
echo "${{ inputs.install-path }}/godot"
|
|
|
|
- name: "print restored version - ${{ inputs.godot-version }}"
|
|
shell: bash
|
|
run: |
|
|
${{ inputs.install-path }}/godot --version
|
|
|
|
- name: "Set .NET SDK version"
|
|
if: ${{ !cancelled() }}
|
|
shell: bash
|
|
run: |
|
|
sdk_version=$(echo "${{ inputs.dotnet-version }}" | sed 's/^net\([0-9]\.[0-9]\)$/\1.x/')
|
|
echo "SDK_VERSION=$sdk_version" >> "$GITHUB_ENV"
|
|
echo "Using .NET version: '$sdk_version'"
|
|
|
|
- name: "Setup .NET SDK"
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: "${{ env.SDK_VERSION }}"
|
|
|
|
- name: "Restore .Net Project"
|
|
if: ${{ !cancelled() }}
|
|
shell: bash
|
|
run: |
|
|
cd "${{ inputs.project_dir }}"
|
|
|
|
dotnet --version
|
|
dotnet build
|
|
dotnet list package
|
|
|
|
- name: "Restore Godot project cache"
|
|
if: ${{ !cancelled() }}
|
|
env:
|
|
GODOT_BIN: "${{ inputs.install-path }}/godot"
|
|
shell: bash
|
|
run: |
|
|
cd "${{ inputs.project_dir }}"
|
|
echo -e "\e[94mStart of the recovery of the project cache ...\e[0m"
|
|
$GODOT_BIN --path ./ -e --headless --build-solutions --quit --import
|
|
echo -e "\e[94mProject cache successfully restored.\e[0m"
|