141 lines
6.5 KiB
YAML

name: Mod Build
on:
push:
tags:
- "*"
env:
MOD_NAME: "RefinedRDApi"
MOD_ID: "" # TBD
SML_DIR: "E:/SF/SML"
ENGINE_DIR: "F:/5.2.1-CSS"
BUILT_MODS_DIR: "${{ gitea.workspace }}/BuiltMods"
DEV_BUILDS_DIR: "${{ gitea.workspace }}/DevBuilds"
jobs:
Setup:
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- name: Setup SML
run: |
if (!(Test-Path ${{env.SML_DIR}} -PathType Container)) {git clone --branch master https://github.com/satisfactorymodding/SatisfactoryModLoader.git ${{env.SML_DIR}}}
- name: Install WWise
run: |
cd ${{env.SML_DIR}}
if ((Test-Path ${{env.SML_DIR}}/Plugins/Wwise) -eq $true){ echo "WWise already Installed Skipping.."; exit 0 }
E:/SF/Scripts/wwise-cli.exe integrate-ue --integration-version "2022.1.5.2714" --project "${{env.SML_DIR}}/FactoryGame.uproject"
- name: "SML Headers"
run: |
cd E:/SF/Scripts/sml-fixer
./sml-fixer.exe
PullMods:
needs: Setup
strategy:
matrix:
value: ["RefinedRDLib"]
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- name: "Clone Mod"
run: |
echo "Cloning Mod ${{matrix.value}}"
cd ${{env.SML_DIR}}/Mods
if (!(Test-Path ${{env.SML_DIR}}/Mods/${{matrix.value}} -PathType Container)) {git clone --branch main git@10.10.10.14:RefinedRD/sf_mod_${{matrix.value}}.git ${{env.SML_DIR}}/Mods/${{matrix.value}}}
cd ${{env.SML_DIR}}/Mods/${{matrix.value}}
git fetch --all
git reset --hard origin/main
echo "Done"
UpdateUPlugins:
needs: PullMods
strategy:
matrix:
value: ["RefinedRDLib"]
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- name: "Update Mod UPlugin Version"
run: |
echo "Updating ${{env.SML_DIR}}/Mods/${{matrix.value}}/${{matrix.value}}.uplugin"
$Uplugin = (Get-Content ${{env.SML_DIR}}/Mods/${{matrix.value}}/${{matrix.value}}.uplugin | convertfrom-json)
$UPlugin.SemVersion = $(Get-Content "${{env.SML_DIR}}/Mods/${{matrix.value}}/VERSION")
$UPlugin.VersionName = $(Get-Content "${{env.SML_DIR}}/Mods/${{matrix.value}}/VERSION")
$Version = $Uplugin.SemVersion
($UPlugin | convertto-json -Depth 100) -replace '\\u0026', '&' | Set-Content ${{env.SML_DIR}}/Mods/${{matrix.value}}/${{matrix.value}}.uplugin
echo "Done"
CompileEditor:
needs: UpdateModUPluginDependencies
runs-on: windows-2022
outputs:
version: ${{steps.getversion.outputs.version}}
defaults:
run:
shell: pwsh
env:
BUILD_TOOL_EXE: ${{env.ENGINE_DIR}}/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe
steps:
- name: Get Version
id: getversion
run: |
$Version = $(Get-Content "${{env.SML_DIR}}/Mods/${{env.MOD_NAME}}/VERSION")
Write-Output "version=$($Version)" >> $Env:GITHUB_OUTPUT
- name: "Gen-VS-Files"
run: |
cd ${{env.SML_DIR}}
${{env.BUILD_TOOL_EXE}} -projectfiles -project="${{env.SML_DIR}}/FactoryGame.uproject" -game -rocket -progress
- name: Compile Editor
run: |
cd ${{env.SML_DIR}}
${{env.BUILD_TOOL_EXE}} Development Win64 -project="${{env.SML_DIR}}/FactoryGame.uproject" -TargetType="Editor" -progress
BuildMods:
needs: CompileEditor
strategy:
matrix:
value: ["RefinedRDLib"]
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- name: "Build Mod"
run: |
$Version = $(Get-Content "${{env.SML_DIR}}/Mods/${{matrix.value}}/VERSION")
& "${{env.ENGINE_DIR}}/Engine/Build/BatchFiles/RunUAT.bat" -ScriptsForProject="${{env.SML_DIR}}/FactoryGame.uproject" PackagePlugin -Project="${{env.SML_DIR}}/FactoryGame.uproject" -dlcname="${{matrix.value}}" -build -server -clientconfig=Shipping -serverconfig=Shipping -platform=Win64 -serverplatform=Win64+Linux -nocompileeditor -installed -merge
if (!(Test-Path ${{env.BUILT_MODS_DIR}})) {New-Item -ItemType Directory -Force -Path ${{env.BUILT_MODS_DIR}}}
Copy-Item ${{env.SML_DIR}}/Saved/ArchivedPlugins/${{matrix.value}}/${{matrix.value}}.zip ${{env.BUILT_MODS_DIR}}/${{matrix.value}}.$Version.zip -Force
- uses: actions/upload-artifact@v3
with:
name: built-mods
path: ${{env.BUILT_MODS_DIR}}/${{matrix.value}}.*.zip
overwrite: true
SMRDeploy:
if: ${{ vars.DEPLOY != 'false' }}
needs: BuildMods
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- name: Download a artifact
uses: actions/download-artifact@v3
with:
name: built-mods
path: ${{env.BUILT_MODS_DIR}}
- name: "Deploy to SMR"
run: |
echo "Deploying to SMR"
$Version = $(Get-Content "${{env.SML_DIR}}/Mods/${{env.MOD_NAME}}/VERSION")
$query = '{ "query": "query { getModByReference(modReference:\"${{env.MOD_NAME}}\"){ versions(filter:{limit: 1}){ version } }}"}'
echo $query
$SMRVersion = (Invoke-RestMethod -Method POST -uri "https://api.ficsit.app/v2/query" -body $query -ContentType "application/json").data.getModByReference.versions[0].version
if($Version -eq $SMRVersion) { echo "SMR Mod Version Already Exists.. Skip"; exit 0 }
$File = (Get-ChildItem "${{env.BUILT_MODS_DIR}}/${{env.MOD_NAME}}*").FullName
$APIURL="https://api.ficsit.app"
write-host "$File, $APIURL"
& "E:/SF/Scripts/ficsit_windows_amd64.exe" smr upload --api-base "$APIURL" --api-key "${{secrets.FICSIT_TOKEN}}" "${{env.MOD_ID}}" "$File" "${{vars.CHANGELOG}}"
echo "Done"