Now Downloading Resonite from Steam (#47) #165
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: Build & Test (MonkeyLoader) | |
on: | |
push: | |
pull_request: | |
workflow_call: | |
inputs: | |
RELEASE_VERSION: | |
description: "Release Version" | |
type: string | |
required: false | |
default: "" | |
RELEASE_NOTES: | |
description: "Release Notes" | |
type: string | |
required: false | |
default: "" | |
secrets: | |
STEAM_USER: | |
required: true | |
STEAM_TOKEN: | |
required: true | |
env: | |
ARTIFACT_NAME: "SampleMod" | |
ASSEMBLY_NAME: "mpmxyz.SampleMod.MonkeyLoader" | |
PROJECT_FILE: "SampleModMonkey.csproj" | |
ResonitePath: "${{ github.workspace }}/Download/Resonite" | |
PROJECT_URL: "${{ github.server_url }}/${{ github.repository }}" | |
PROJECT_PATH: "${{ github.workspace }}/repo" | |
RELEASE_NOTES: "${{ inputs.RELEASE_NOTES }}" | |
RELEASE_VERSION: "${{ inputs.RELEASE_VERSION }}" | |
OUTPUT_FOLDER: "bin/MonkeyLoader/Release" | |
TEST_PROJECT_FILE: "Test/Test.csproj" | |
MOD_LOADER_TEST_PROJECT_FILE: "TestMonkey/TestMonkey.csproj" | |
defaults: | |
run: | |
working-directory: "./repo" | |
jobs: | |
build-MonkeyLoader: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Ensure working directory exists | |
run: mkdir -p '${{ env.PROJECT_PATH }}' | |
working-directory: "${{ github.workspace }}" | |
- name: Get Resonite Infos | |
run: | | |
{ | |
echo "APP_INFO<<EOFEOF" | |
curl https://api.steamcmd.net/v1/info/2519830 | |
echo "" | |
echo "EOFEOF" | |
} >> "$GITHUB_ENV" | |
- name: Get Resonite from Cache | |
id: cache-resonite | |
uses: actions/[email protected] | |
with: | |
path: "${{ env.ResonitePath }}" | |
key: "${{ fromJson( env.APP_INFO ).data['2519830'].depots.branches.public.buildid }}" | |
- name: Download Steam | |
if: steps.cache-resonite.outputs.cache-hit != 'true' | |
uses: CyberAndrii/setup-steamcmd@b786e0da44db3d817e66fa3910a9560cb28c9323 | |
- name: Download Resonite | |
if: steps.cache-resonite.outputs.cache-hit != 'true' | |
run: | | |
steamcmd '+@sSteamCmdForcePlatformType windows' '+force_install_dir "${{ env.ResonitePath }}"' '+login "${{ secrets.STEAM_USER }}" "${{ secrets.STEAM_TOKEN }}"' '+app_license_request 2519830' '+app_update 2519830 validate' '+quit' | |
#The following line makes the cache much much smaller: | |
rm -r '${{ env.ResonitePath }}/RuntimeData/PreCache' | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Fetch repository | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.PROJECT_PATH }} | |
- name: Fetch MonkeyLoader | |
uses: robinraju/release-downloader@efa4cd07bd0195e6cc65e9e30c251b49ce4d3e51 | |
with: | |
repository: Banane9/MonkeyLoader | |
tag: v0.1.0-alpha | |
fileName: "MonkeyLoader*.zip" | |
out-file-path: MonkeyLoader/ | |
- name: Move MonkeyLoader files | |
run: | | |
mkdir -p "$PROJECT_PATH/MonkeyLoader GamePacks" | |
mkdir -p "$PROJECT_PATH/MonkeyLoader Mods" | |
mkdir -p "$ResonitePath/MonkeyLoader/GamePacks" | |
mkdir -p "$ResonitePath/MonkeyLoader/Mods" | |
unzip -o "${{ github.workspace }}/MonkeyLoader/MonkeyLoader*.zip" -d "$ResonitePath" | |
- name: Restore dependencies | |
run: | | |
dotnet restore "${{ env.PROJECT_FILE }}" | |
dotnet restore "${{ env.TEST_PROJECT_FILE }}" | |
dotnet restore "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}" | |
env: | |
ASSEMBLY_NAME: "" | |
- name: Check formatting | |
run: | | |
dotnet format --no-restore --verify-no-changes "${{ env.PROJECT_FILE }}" | |
dotnet format --no-restore --verify-no-changes "${{ env.TEST_PROJECT_FILE }}" | |
dotnet format --no-restore --verify-no-changes "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}" | |
env: | |
ASSEMBLY_NAME: "" | |
- name: Test | |
run: | | |
dotnet test --no-restore --configuration "Release" "${{ env.TEST_PROJECT_FILE }}" | |
dotnet test --no-restore --configuration "Release" "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}" | |
env: | |
ASSEMBLY_NAME: "" | |
- name: Build | |
run: | | |
dotnet build --no-restore --configuration "Release" "${{ env.PROJECT_FILE }}" | |
- name: Upload build artifacts | |
if: ${{ inputs.RELEASE_VERSION }} | |
uses: actions/[email protected] | |
with: | |
name: "${{ env.ARTIFACT_NAME }}-MonkeyLoader" | |
path: "${{ env.PROJECT_PATH }}/${{ env.OUTPUT_FOLDER }}/${{ env.ASSEMBLY_NAME }}.${{ inputs.RELEASE_VERSION }}.nupkg" |