From 9aeb7b20d529e8a8bfa376450d60fe7c8be623be Mon Sep 17 00:00:00 2001 From: Zachary Lockwood Date: Thu, 1 Aug 2024 15:17:05 -0400 Subject: [PATCH] Add github build workflow --- .github/workflows/build.yml | 199 ++++++++++++++++++++++++++++++++++ Sporemod/ModInfo.xml | 6 + UniversalPropertyEnhancer.sln | 24 +--- source/SdkPathConfig.props | 2 +- 4 files changed, 207 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 Sporemod/ModInfo.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..533b6b3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,199 @@ +name: Build UniversalPropertyEnhancer + +on: + push: + workflow_dispatch: + +env: +# Build Packages Variables + SPORE_MODDER_FX_TAG: 'v2.2.10' + SPORE_MODDER_FX_FILE: 'SporeModder.FX.zip' + +# Build DLLs Variables + SPORE_MOD_API_REF: 'v2.5.326' + SPORE_LUA_API_REF: '67811a03f2edc84a26956c512d0180564ebe0dd3' + SPORE_MOD_API_BUILD_VER: '326' + +#Build Sporemod Variables + SPOREMOD_DLLS_BUILD: '2.5.326' + SPOREMOD_PREFIX: 'UPE' + +jobs: + build-packages: + name: Build Packages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '11' + java-package: 'jre' + - name: Setup SMFX + uses: robinraju/release-downloader@v1 + with: + repository: 'emd4600/SporeModder-FX' + tag: ${{ env.SPORE_MODDER_FX_TAG }} + fileName: ${{ env.SPORE_MODDER_FX_FILE }} + tarBall: false + zipBall: false + out-file-path: '' + extract: true + - run: mkdir -p Packages + - name: Build SMFX Project + run: | + cd "SporeModder FX" + java -jar SporeModderFX.jar pack ../Projects/UniversalPropertyEnhancer ../Packages/UniversalPropertyEnhancer.package + - name: Upload Packages + uses: actions/upload-artifact@v4 + with: + name: packages + retention-days: 1 + compression-level: 0 + path: Packages/* + + build-dlls: + name: Build DLLs + runs-on: windows-2022 + steps: + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + # Build Spore-ModAPI + - name: Cache Spore-ModAPI + id: cache-spore-modapi + uses: actions/cache/restore@v4 + with: + path: Spore-ModAPI + key: spore-modapi-${{ env.SPORE_MOD_API_REF }} + - name: Checkout Spore-ModAPI + if: ${{ steps.cache-spore-modapi.outputs.cache-hit != 'true' }} + uses: actions/checkout@v4 + with: + repository: 'emd4600/Spore-ModAPI' + ref: ${{ env.SPORE_MOD_API_REF }} + path: 'Spore-ModAPI' + submodules: 'true' + - name: Build Spore ModAPI + run: | + cd Spore-ModAPI + msbuild "Spore ModAPI" /m "/p:Configuration=Release DLL,Platform=x86,SDK_BUILD_VER=${{ env.SPORE_MOD_API_BUILD_VER }},EXECUTABLE_TYPE=2" ` + "/p:OutDir=${{ github.workspace }}\coreLibs\" /clp:Summary /v:m + - name: Save Spore-ModAPI + if: ${{ ! contains(github.ref_type, 'tag') && steps.cache-spore-modapi.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v4 + with: + path: Spore-ModAPI + key: ${{ steps.cache-spore-modapi.outputs.cache-primary-key }} + + # Build Spore-LuaAPI + - name: Cache Spore-LuaAPI + id: cache-spore-luaapi + uses: actions/cache/restore@v4 + with: + path: Spore-LuaAPI + key: spore-luaapi-${{ env.SPORE_LUA_API_REF }} + - name: Checkout Spore-LuaAPI + if: ${{ steps.cache-spore-luaapi.outputs.cache-hit != 'true' }} + uses: actions/checkout@v4 + with: + repository: 'Zarklord/Spore-LuaAPI' + ref: ${{ env.SPORE_LUA_API_REF }} + path: 'Spore-LuaAPI' + submodules: 'true' + - name: Build Spore LuaAPI + run: | + cd Spore-LuaAPI + msbuild "Spore LuaAPI.sln" /m "/p:Configuration=Release DLL,Platform=x86" ` + "/p:SporeSDKPath=${{ github.workspace }}\Spore-ModAPI\,SporeLauncherPath=${{ github.workspace }}\" ` + "/p:OutDir=${{ github.workspace }}\coreLibs\" /clp:Summary /v:m + - name: Save Spore-LuaAPI + if: ${{ ! contains(github.ref_type, 'tag') && steps.cache-spore-luaapi.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v4 + with: + path: Spore-LuaAPI + key: ${{ steps.cache-spore-luaapi.outputs.cache-primary-key }} + + #Build UniversalPropertyEnhancer + - name: Checkout UniversalPropertyEnhancer + uses: actions/checkout@v4 + with: + path: ${{ github.event.repository.name }} + submodules: 'true' + - name: Build UniversalPropertyEnhancer + run: | + cd ${{ github.event.repository.name }} + msbuild UniversalPropertyEnhancer.sln /m /p:Configuration=Release,Platform=x86 ` + "/p:SporeSDKPath=${{ github.workspace }}\Spore-ModAPI\,SporeLuaSdkPath=${{ github.workspace }}\Spore-LuaAPI\,SporeLauncherPath=${{ github.workspace }}\" ` + "/p:OutDir=${{ github.workspace }}\coreLibs\" /clp:Summary /v:m + - name: Upload DLL + uses: actions/upload-artifact@v4 + with: + name: dll + retention-days: 1 + compression-level: 0 + path: | + coreLibs/UniversalPropertyEnhancer.dll + coreLibs/UniversalPropertyEnhancer.pdb + + build-sporemod: + name: Build Sporemod + needs: [ build-packages, build-dlls ] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + path: ${{ github.workspace }}/Sporemod + merge-multiple: true + + # any tag that doesn't match v.X.X.X (with an optional single character path, eg v1.2.73b) will be marked as experimental + - run: echo "${{ github.ref_name }}" | grep -qE '^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+[[:alpha:]]?$' + id: test_experimental + continue-on-error: true + - run: echo "SPOREMOD_EXPERIMENTAL=${{ steps.test_experimental.outcome != 'success' }}" >> $GITHUB_ENV + + - uses: iamazeem/substitute-action@v1 + with: + input-files: | + Sporemod/ModInfo.xml + enable-in-place: true + - run: ls ${{ github.workspace }}/Sporemod + + - if: ${{ contains(github.ref_type, 'tag') }} + run: echo "SPOREMOD_NAME=${{ env.SPOREMOD_PREFIX }}${{ github.ref_name }}.sporemod" >> $GITHUB_ENV + - if: ${{ ! contains(github.ref_type, 'tag') }} + run: echo "SPOREMOD_NAME=${{ env.SPOREMOD_PREFIX }}${{ github.ref_name }}-$(git rev-parse --short HEAD).sporemod" >> $GITHUB_ENV + + - run: echo "DRAFT_RELEASE_NAME=$(echo "${{ github.event.repository.name }} ${{ github.ref_name }}" | tr '-' ' ')" >> $GITHUB_ENV + + - name: Create sporemod + uses: thedoctor0/zip-release@0.7.6 + with: + type: 'zip' + filename: ${{ env.SPOREMOD_NAME }} + path: 'Sporemod' + custom: '-j -9' + + - name: Create draft release + if: ${{ contains(github.ref_type, 'tag') }} + uses: ncipollo/release-action@v1.14.0 + with: + draft: true + name: ${{ env.DRAFT_RELEASE_NAME }} + prerelease: ${{ env.SPOREMOD_EXPERIMENTAL }} + makeLatest: true + tag: ${{ github.ref_name }} + artifacts: ${{ env.SPOREMOD_NAME }} + + - name: Upload sporemod artifact + if: ${{ ! contains(github.ref_type, 'tag') }} + uses: actions/upload-artifact@v4 + with: + name: sporemod + retention-days: 30 + compression-level: 0 + path: ${{ env.SPOREMOD_NAME }} diff --git a/Sporemod/ModInfo.xml b/Sporemod/ModInfo.xml new file mode 100644 index 0000000..1a944fe --- /dev/null +++ b/Sporemod/ModInfo.xml @@ -0,0 +1,6 @@ + + UniversalPropertyEnhancer.dll + UniversalPropertyEnhancer.package + UniversalPropertyReplacement* + UPEVerify.package + \ No newline at end of file diff --git a/UniversalPropertyEnhancer.sln b/UniversalPropertyEnhancer.sln index d0dda45..5a14623 100644 --- a/UniversalPropertyEnhancer.sln +++ b/UniversalPropertyEnhancer.sln @@ -9,7 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalPropertyEnhancer", {F057451A-1413-4D68-AF56-1BF529933420} = {F057451A-1413-4D68-AF56-1BF529933420} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Spore ModAPI", "..\..\SourceCode\Spore-ModAPI\Spore ModAPI\Spore ModAPI.vcxproj", "{F057451A-1413-4D68-AF56-1BF529933420}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Spore ModAPI", "..\Spore-ModAPI\Spore ModAPI\Spore ModAPI.vcxproj", "{F057451A-1413-4D68-AF56-1BF529933420}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Spore LuaAPI", "..\Spore-LuaAPI\Spore LuaAPI\Spore LuaAPI.vcxproj", "{51E418B6-56B0-430E-AA00-15E1B30DE8DF}" EndProject @@ -19,50 +19,28 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tracy", "..\Spore-LuaAPI\tr EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|x86 = Debug DLL|x86 Debug|x86 = Debug|x86 - Release DLL|x86 = Release DLL|x86 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Debug DLL|x86.ActiveCfg = Debug|Win32 - {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Debug DLL|x86.Build.0 = Debug|Win32 {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Debug|x86.ActiveCfg = Debug|Win32 {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Debug|x86.Build.0 = Debug|Win32 - {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Release DLL|x86.ActiveCfg = Release|Win32 - {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Release DLL|x86.Build.0 = Release|Win32 {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Release|x86.ActiveCfg = Release|Win32 {07FC5B61-B575-4207-B464-AFAE6AF3FC19}.Release|x86.Build.0 = Release|Win32 - {F057451A-1413-4D68-AF56-1BF529933420}.Debug DLL|x86.ActiveCfg = Debug DLL|Win32 - {F057451A-1413-4D68-AF56-1BF529933420}.Debug DLL|x86.Build.0 = Debug DLL|Win32 {F057451A-1413-4D68-AF56-1BF529933420}.Debug|x86.ActiveCfg = Debug|Win32 {F057451A-1413-4D68-AF56-1BF529933420}.Debug|x86.Build.0 = Debug|Win32 - {F057451A-1413-4D68-AF56-1BF529933420}.Release DLL|x86.ActiveCfg = Release DLL|Win32 - {F057451A-1413-4D68-AF56-1BF529933420}.Release DLL|x86.Build.0 = Release DLL|Win32 {F057451A-1413-4D68-AF56-1BF529933420}.Release|x86.ActiveCfg = Release|Win32 {F057451A-1413-4D68-AF56-1BF529933420}.Release|x86.Build.0 = Release|Win32 - {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Debug DLL|x86.ActiveCfg = Debug DLL|Win32 - {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Debug DLL|x86.Build.0 = Debug DLL|Win32 {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Debug|x86.ActiveCfg = Debug|Win32 {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Debug|x86.Build.0 = Debug|Win32 - {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Release DLL|x86.ActiveCfg = Release DLL|Win32 - {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Release DLL|x86.Build.0 = Release DLL|Win32 {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Release|x86.ActiveCfg = Release|Win32 {51E418B6-56B0-430E-AA00-15E1B30DE8DF}.Release|x86.Build.0 = Release|Win32 - {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Debug DLL|x86.ActiveCfg = Debug DLL|Win32 - {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Debug DLL|x86.Build.0 = Debug DLL|Win32 {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Debug|x86.ActiveCfg = Debug|Win32 {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Debug|x86.Build.0 = Debug|Win32 - {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Release DLL|x86.ActiveCfg = Release DLL|Win32 - {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Release DLL|x86.Build.0 = Release DLL|Win32 {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Release|x86.ActiveCfg = Release|Win32 {2B86CB31-7638-4BCD-BACE-97D1DC37DB65}.Release|x86.Build.0 = Release|Win32 - {79338010-B010-4950-B2D1-F4E187E74B8B}.Debug DLL|x86.ActiveCfg = Debug DLL|Win32 - {79338010-B010-4950-B2D1-F4E187E74B8B}.Debug DLL|x86.Build.0 = Debug DLL|Win32 {79338010-B010-4950-B2D1-F4E187E74B8B}.Debug|x86.ActiveCfg = Debug|Win32 {79338010-B010-4950-B2D1-F4E187E74B8B}.Debug|x86.Build.0 = Debug|Win32 - {79338010-B010-4950-B2D1-F4E187E74B8B}.Release DLL|x86.ActiveCfg = Release DLL|Win32 - {79338010-B010-4950-B2D1-F4E187E74B8B}.Release DLL|x86.Build.0 = Release DLL|Win32 {79338010-B010-4950-B2D1-F4E187E74B8B}.Release|x86.ActiveCfg = Release|Win32 {79338010-B010-4950-B2D1-F4E187E74B8B}.Release|x86.Build.0 = Release|Win32 EndGlobalSection diff --git a/source/SdkPathConfig.props b/source/SdkPathConfig.props index ff1397d..400c215 100644 --- a/source/SdkPathConfig.props +++ b/source/SdkPathConfig.props @@ -2,7 +2,7 @@ - D:\SourceCode\Spore-ModAPI\ + D:\SporeDLLMods\Spore-ModAPI\ D:\SporeDLLMods\Spore-LuaAPI\ D:\Programs\Spore ModAPI Launcher Kit\