ci: Workflow updates
This commit is contained in:
+191
-105
@@ -1,150 +1,236 @@
|
|||||||
name: Mod Build
|
name: Mod Build
|
||||||
on:
|
on: push
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
env:
|
env:
|
||||||
MOD_NAME: "RefinedRDApi"
|
MOD_NAME: "RefinedRDApi"
|
||||||
MOD_ID: "7q2RnptXynYzEX"
|
MOD_ID: "7q2RnptXynYzEX"
|
||||||
SML_DIR: "S:/SF/SML"
|
SML_DIR: "S:/SML"
|
||||||
ENGINE_DIR: "F:/5.3.2-CSS"
|
ENGINE_DIR: "S:/UE"
|
||||||
BUILT_MODS_DIR: "${{ gitea.workspace }}/BuiltMods"
|
BUILT_MODS_DIR: "${{ gitea.workspace }}/BuiltMods"
|
||||||
DEV_BUILDS_DIR: "${{ gitea.workspace }}/DevBuilds"
|
DEV_BUILDS_DIR: "${{ gitea.workspace }}/DevBuilds"
|
||||||
|
MODS_TO_BUILD: "RefinedRDApi"
|
||||||
|
MOD_DEPENDENCIES: ""
|
||||||
|
IS_GAME_FEATURE_PLUGIN: "false"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Setup:
|
Details:
|
||||||
runs-on: windows-2022
|
runs-on: ubuntu-docker
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
echo "DEPLOY: ${{vars.DEPLOY}}"
|
||||||
|
echo "DEVBUILD: ${{vars.DEVBUILD}}"
|
||||||
|
echo "Branch/Tag: ${{gitea.ref_name}}"
|
||||||
|
echo "Mod Name: ${{env.MOD_NAME}}"
|
||||||
|
echo "SML Directory: ${{env.SML_DIR}}"
|
||||||
|
echo "Engine Directory: ${{env.ENGINE_DIR}}"
|
||||||
|
echo "Built Mods Directory: ${{env.BUILT_MODS_DIR}}"
|
||||||
|
echo "Dev Build Directory: ${{env.DEV_BUILDS_DIR}}"
|
||||||
|
echo "Change Log: ${{vars.CHANGELOG}}"
|
||||||
|
|
||||||
|
Build:
|
||||||
|
runs-on: windows-ue
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
outputs:
|
||||||
|
version: ${{steps.version.outputs.version}}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Compute Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
$year = (Get-Date).Year
|
||||||
|
$month = (Get-Date).Month
|
||||||
|
$quarter = [math]::Ceiling($month / 3)
|
||||||
|
$quarterKey = "$year.$quarter"
|
||||||
|
|
||||||
|
$response = curl -s -X POST `
|
||||||
|
-H "x-rp-key: ${{secrets.RRD_API_KEY}}" `
|
||||||
|
-H "Content-Type: application/json" `
|
||||||
|
-d "{`"quarter`":`"$quarterKey`"}" `
|
||||||
|
"${{secrets.RRD_API_URL}}/api/v1/mods/buildnumber/${{env.MOD_NAME}}/increment" | ConvertFrom-Json
|
||||||
|
|
||||||
|
if (-not $response.build) {
|
||||||
|
Write-Error "Failed to get build number from API"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$version = "$quarterKey.$($response.build)"
|
||||||
|
Write-Output "version=$version" >> $Env:GITHUB_OUTPUT
|
||||||
|
echo "Computed version: $version"
|
||||||
|
|
||||||
- name: Setup SML
|
- name: Setup SML
|
||||||
run: |
|
run: |
|
||||||
if (!(Test-Path ${{env.SML_DIR}} -PathType Container)) {git clone --branch dev https://github.com/satisfactorymodding/SatisfactoryModLoader.git ${{env.SML_DIR}}}
|
if (Test-Path "${{env.SML_DIR}}/.git" -PathType Container) {
|
||||||
- name: Install WWise
|
cd ${{env.SML_DIR}}
|
||||||
run: |
|
git fetch origin dev
|
||||||
cd ${{env.SML_DIR}}
|
git reset --hard origin/dev
|
||||||
if ((Test-Path ${{env.SML_DIR}}/Plugins/Wwise) -eq $true){ echo "WWise already Installed Skipping.."; exit 0 }
|
} else {
|
||||||
S:/SF/Scripts/wwise-cli.exe integrate-ue --integration-version "2022.1.5.2714" --project "${{env.SML_DIR}}/FactoryGame.uproject"
|
git clone --branch dev https://github.com/satisfactorymodding/SatisfactoryModLoader.git ${{env.SML_DIR}}
|
||||||
- name: Pull WWise Project
|
}
|
||||||
|
|
||||||
|
- name: Pull Wwise Project
|
||||||
run: |
|
run: |
|
||||||
|
if (!(Test-Path "${{env.SML_DIR}}/SML_WwiseProject" -PathType Container)) {
|
||||||
|
git clone --branch main git@10.10.10.14:RefinedRD/WwiseProject.git "${{env.SML_DIR}}/SML_WwiseProject"
|
||||||
|
}
|
||||||
cd ${{env.SML_DIR}}/SML_WwiseProject
|
cd ${{env.SML_DIR}}/SML_WwiseProject
|
||||||
git fetch --all
|
git fetch --all
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
git lfs fetch --all
|
git lfs fetch --all
|
||||||
git lfs pull
|
git lfs pull
|
||||||
git lfs checkout
|
git lfs checkout
|
||||||
& "C:/Program Files (x86)/Audiokinetic/Wwise2023.1.3.8471/Authoring/x64/Release/bin/WwiseConsole.exe" generate-soundbank "${{env.SML_DIR}}/SML_WwiseProject/SML_WwiseProject.wproj" --platform Windows Mac --verbose
|
$wwiseConsole = "C:/Program Files (x86)/Audiokinetic/Wwise2023.1.14.8770/Authoring/x64/Release/bin/WwiseConsole.exe"
|
||||||
|
if (!(Test-Path $wwiseConsole)) {
|
||||||
|
Write-Error "WwiseConsole not found at $wwiseConsole"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
& $wwiseConsole generate-soundbank "${{env.SML_DIR}}/SML_WwiseProject/SML_WwiseProject.wproj" --platform Windows Mac --verbose
|
||||||
echo "Done"
|
echo "Done"
|
||||||
- name: "SML Headers"
|
|
||||||
|
- name: Pull Mods
|
||||||
run: |
|
run: |
|
||||||
cd S:/SF/Scripts/sml-fixer
|
$modPath = "${{env.SML_DIR}}/Mods/${{env.MOD_NAME}}"
|
||||||
./sml-fixer.exe
|
$repoName = "sf_mod_${{env.MOD_NAME}}"
|
||||||
PullMods:
|
|
||||||
needs: Setup
|
if ("${{env.IS_GAME_FEATURE_PLUGIN}}" -eq "true") {
|
||||||
strategy:
|
$modPath = "${{env.SML_DIR}}/Mods/GameFeatures/${{env.MOD_NAME}}"
|
||||||
matrix:
|
}
|
||||||
value: ["RefinedRDApi"]
|
|
||||||
runs-on: windows-2022
|
if (!(Test-Path $modPath -PathType Container)) {
|
||||||
defaults:
|
git clone git@10.10.10.14:RefinedRD/$repoName.git $modPath
|
||||||
run:
|
}
|
||||||
shell: pwsh
|
|
||||||
steps:
|
cd $modPath
|
||||||
- name: "Clone Mod"
|
$ref = "${{gitea.ref_name}}"
|
||||||
|
git fetch --all --tags
|
||||||
|
if (git rev-parse --verify --quiet "refs/tags/$ref") {
|
||||||
|
git reset --hard $ref
|
||||||
|
} else {
|
||||||
|
git reset --hard "origin/$ref"
|
||||||
|
}
|
||||||
|
echo "Pulled ${{env.MOD_NAME}} @ latest (${{gitea.ref_name}})"
|
||||||
|
|
||||||
|
- name: Update UPlugin Versions
|
||||||
run: |
|
run: |
|
||||||
echo "Cloning Mod ${{matrix.value}}"
|
$newVersion = "${{steps.version.outputs.version}}"
|
||||||
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}}}
|
$mod = "${{env.MOD_NAME}}"
|
||||||
cd ${{env.SML_DIR}}/Mods/${{matrix.value}}
|
$modPath = "${{env.SML_DIR}}/Mods/$mod"
|
||||||
git fetch --all
|
|
||||||
git reset --hard origin/main
|
if ("${{env.IS_GAME_FEATURE_PLUGIN}}" -eq "true") {
|
||||||
echo "Done"
|
$modPath = "${{env.SML_DIR}}/Mods/GameFeatures/$mod"
|
||||||
UpdateUPlugins:
|
}
|
||||||
needs: PullMods
|
|
||||||
strategy:
|
$upluginPath = "$modPath/$mod.uplugin"
|
||||||
matrix:
|
$UPlugin = (Get-Content $upluginPath | ConvertFrom-Json)
|
||||||
value: ["RefinedRDApi"]
|
|
||||||
runs-on: windows-2022
|
$majorVersion = [int]($newVersion -split '\.')[0]
|
||||||
defaults:
|
|
||||||
run:
|
$UPlugin.Version = $majorVersion
|
||||||
shell: pwsh
|
$UPlugin.SemVersion = $newVersion
|
||||||
steps:
|
$UPlugin.VersionName = $newVersion
|
||||||
- name: "Update Mod UPlugin Version"
|
echo "Set $mod version to $newVersion (Version=$majorVersion)"
|
||||||
run: |
|
|
||||||
echo "Updating ${{env.SML_DIR}}/Mods/${{matrix.value}}/${{matrix.value}}.uplugin"
|
($UPlugin | ConvertTo-Json -Depth 100) -replace '\\u0026', '&' | Set-Content $upluginPath
|
||||||
$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: UpdateUPlugins
|
|
||||||
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
|
- name: Compile Editor
|
||||||
run: |
|
run: |
|
||||||
|
$buildTool = "${{env.ENGINE_DIR}}/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe"
|
||||||
cd ${{env.SML_DIR}}
|
cd ${{env.SML_DIR}}
|
||||||
${{env.BUILD_TOOL_EXE}} Development Win64 -project="${{env.SML_DIR}}/FactoryGame.uproject" -TargetType="Editor" -progress
|
& $buildTool -projectfiles -project="${{env.SML_DIR}}/FactoryGame.uproject" -game -rocket -progress
|
||||||
BuildMods:
|
& $buildTool Development Win64 -project="${{env.SML_DIR}}/FactoryGame.uproject" -TargetType="Editor" -progress
|
||||||
needs: CompileEditor
|
|
||||||
strategy:
|
- name: Build Mods
|
||||||
matrix:
|
|
||||||
value: ["RefinedRDApi"]
|
|
||||||
runs-on: windows-2022
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: pwsh
|
|
||||||
steps:
|
|
||||||
- name: "Build Mod"
|
|
||||||
run: |
|
run: |
|
||||||
$Version = $(Get-Content "${{env.SML_DIR}}/Mods/${{matrix.value}}/VERSION")
|
$newVersion = "${{steps.version.outputs.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}}}
|
if (!(Test-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
|
New-Item -ItemType Directory -Force -Path ${{env.BUILT_MODS_DIR}}
|
||||||
|
}
|
||||||
|
$mod = "${{env.MOD_NAME}}"
|
||||||
|
if (Test-Path "${{env.SML_DIR}}/Saved/ArchivedPlugins/$mod") {
|
||||||
|
Remove-Item -Recurse "${{env.SML_DIR}}/Saved/ArchivedPlugins/$mod"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("${{env.IS_GAME_FEATURE_PLUGIN}}" -eq "true") {
|
||||||
|
$modPath = "${{env.SML_DIR}}/Mods/GameFeatures/$mod"
|
||||||
|
}else {
|
||||||
|
$modPath = "${{env.SML_DIR}}/Mods/$mod"
|
||||||
|
}
|
||||||
|
|
||||||
|
$version = $newVersion
|
||||||
|
|
||||||
|
& "${{env.ENGINE_DIR}}/Engine/Build/BatchFiles/RunUAT.bat" `
|
||||||
|
-ScriptsForProject="${{env.SML_DIR}}/FactoryGame.uproject" `
|
||||||
|
PackagePlugin `
|
||||||
|
-Project="${{env.SML_DIR}}/FactoryGame.uproject" `
|
||||||
|
-dlcname="$mod" `
|
||||||
|
-build -server `
|
||||||
|
-clientconfig=Shipping -serverconfig=Shipping `
|
||||||
|
-platform=Win64 -serverplatform=Win64+Linux `
|
||||||
|
-nocompileeditor -installed -merge
|
||||||
|
|
||||||
|
Copy-Item "${{env.SML_DIR}}/Saved/ArchivedPlugins/$mod/$mod.zip" "${{env.BUILT_MODS_DIR}}/$mod.$version.zip" -Force
|
||||||
|
|
||||||
|
echo "Done $mod @ $version"
|
||||||
|
|
||||||
|
- name: Publish Built Version
|
||||||
|
run: |
|
||||||
|
$version = "${{steps.version.outputs.version}}"
|
||||||
|
$modPath = "${{env.SML_DIR}}/Mods/${{env.MOD_NAME}}"
|
||||||
|
if ("${{env.IS_GAME_FEATURE_PLUGIN}}" -eq "true") {
|
||||||
|
$modPath = "${{env.SML_DIR}}/Mods/GameFeatures/${{env.MOD_NAME}}"
|
||||||
|
}
|
||||||
|
$commit = (git -C $modPath rev-parse HEAD)
|
||||||
|
$body = "{`"version`":`"$version`",`"commit`":`"$commit`"}"
|
||||||
|
curl -s -X POST `
|
||||||
|
-H "x-rp-key: ${{secrets.RRD_API_KEY}}" `
|
||||||
|
-H "Content-Type: application/json" `
|
||||||
|
-d $body `
|
||||||
|
"${{secrets.RRD_API_URL}}/api/v1/mods/version/${{env.MOD_NAME}}"
|
||||||
|
echo ""
|
||||||
|
echo "Published ${{env.MOD_NAME}} @ $version ($commit)"
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: built-mods
|
name: built-mods
|
||||||
path: ${{env.BUILT_MODS_DIR}}/${{matrix.value}}.*.zip
|
path: |
|
||||||
|
${{env.BUILT_MODS_DIR}}/*.zip
|
||||||
|
${{env.BUILT_MODS_DIR}}/Install-DevBuild.ps1
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
SMRDeploy:
|
SMRDeploy:
|
||||||
if: ${{ vars.DEPLOY != 'false' }}
|
if: ${{ vars.DEPLOY == 'true' }}
|
||||||
needs: BuildMods
|
needs: Build
|
||||||
runs-on: windows-2022
|
runs-on: windows-ue
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
steps:
|
steps:
|
||||||
- name: Download a artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: built-mods
|
name: built-mods
|
||||||
path: ${{env.BUILT_MODS_DIR}}
|
path: ${{env.BUILT_MODS_DIR}}
|
||||||
- name: "Deploy to SMR"
|
|
||||||
|
- name: Deploy to SMR
|
||||||
run: |
|
run: |
|
||||||
echo "Deploying to SMR"
|
echo "Deploying to SMR"
|
||||||
$Version = $(Get-Content "${{env.SML_DIR}}/Mods/${{env.MOD_NAME}}/VERSION")
|
$Version = "${{needs.Build.outputs.version}}"
|
||||||
$query = '{ "query": "query { getModByReference(modReference:\"${{env.MOD_NAME}}\"){ versions(filter:{limit: 1}){ version } }}"}'
|
$query = '{ "query": "query { getModByReference(modReference:\"${{env.MOD_NAME}}\"){ versions(filter:{limit: 1}){ version } }}"}'
|
||||||
echo $query
|
$SMRVersion = (Invoke-RestMethod `
|
||||||
$SMRVersion = (Invoke-RestMethod -Method POST -uri "https://api.ficsit.app/v2/query" -body $query -ContentType "application/json").data.getModByReference.versions[0].version
|
-Method POST `
|
||||||
if($Version -eq $SMRVersion) { echo "SMR Mod Version Already Exists.. Skip"; exit 0 }
|
-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
|
$File = (Get-ChildItem "${{env.BUILT_MODS_DIR}}/${{env.MOD_NAME}}*").FullName
|
||||||
$APIURL="https://api.ficsit.app"
|
$APIURL = "https://api.ficsit.app"
|
||||||
write-host "$File, $APIURL"
|
Write-Host "Uploading $File to $APIURL"
|
||||||
& "S:/SF/Scripts/ficsit_windows_amd64.exe" smr upload --api-base "$APIURL" --api-key "${{secrets.FICSIT_TOKEN}}" "${{env.MOD_ID}}" "$File" "${{vars.CHANGELOG}}"
|
& "S:/ficsit_windows_amd64.exe" smr upload `
|
||||||
|
--api-base "$APIURL" `
|
||||||
|
--api-key "${{secrets.FICSIT_TOKEN}}" `
|
||||||
|
"${{env.MOD_ID}}" "$File" "${{vars.CHANGELOG}}"
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|||||||
Reference in New Issue
Block a user