Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GitHub action for auto building stuff #713

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/Build Mod on PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Mod on PR

on:
pull_request_target:
types: [labeled]

jobs:

build:
if: ${{ contains(github.event.pull_request.labels.*.name, 'safe to test') }}
runs-on: windows-latest

steps:
- name: Build
id: build-action
uses: xADDBx/BuildOwlcatMod@v2
with:
GAME_NAME: Wrath
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_NAME: ${{ github.repository_owner }}
PACKAGE_OWNER: xADDBx
BRANCH_REF: ${{ github.event.pull_request.head.sha }}
DEPENDENCY_LINKS: "https://github.com/Vek17/TabletopTweaks-Core/releases/latest/download/TabletopTweaks-Core.zip"
DEPENDENCY_NAMES: "Mods\\TabletopTweaks-Core\\"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.zipFile }}
path: ${{ env.outDir }}

- name: Remove Test Label
if: always()
shell: bash
run: |
curl --silent --fail-with-body \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.WRITE_PR_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
'https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/safe%20to%20test'
28 changes: 28 additions & 0 deletions .github/workflows/Build Mod on Push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Mod on Push

on:
push:

jobs:

build:
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: windows-latest

steps:
- name: Build
id: build-action
uses: xADDBx/BuildOwlcatMod@v2
with:
GAME_NAME: Wrath
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_NAME: ${{ github.repository_owner }}
PACKAGE_OWNER: xADDBx
DEPENDENCY_LINKS: "https://github.com/Vek17/TabletopTweaks-Core/releases/latest/download/TabletopTweaks-Core.zip"
DEPENDENCY_NAMES: "Mods\\TabletopTweaks-Core\\"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.zipFile }}
path: ${{ env.outDir }}
38 changes: 38 additions & 0 deletions .github/workflows/Create Release for new Tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create Release for new Tag

on:
push:
tags:
- '**'

jobs:

build:
runs-on: windows-latest
permissions:
contents: write
packages: read

steps:
- name: Build
id: build-action
uses: xADDBx/BuildOwlcatMod@v2
with:
GAME_NAME: Wrath
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_NAME: ${{ github.repository_owner }}
PACKAGE_OWNER: xADDBx
DEPENDENCY_LINKS: "https://github.com/Vek17/TabletopTweaks-Core/releases/latest/download/TabletopTweaks-Core.zip"
DEPENDENCY_NAMES: "Mods\\TabletopTweaks-Core\\"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.zipFile }}
path: ${{ env.outDir }}

- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ env.zipFilePath }}\*.zip
name: ${{ env.ZipFile }} built for Wrath ${{ env.gameVersionNum }}${{ env.gameVersionSuffix }}
58 changes: 30 additions & 28 deletions TabletopTweaks-Base/TabletopTweaks-Base.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Aze.Publicise.MSBuild.Task.1.0.0\build\Aze.Publicise.MSBuild.Task.props" Condition="Exists('..\packages\Aze.Publicise.MSBuild.Task.1.0.0\build\Aze.Publicise.MSBuild.Task.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -11,9 +10,11 @@
<RootNamespace>TabletopTweaks.Base</RootNamespace>
<AssemblyName>TabletopTweaks-Base</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<Version>1.0.0</Version>
<FileAlignment>512</FileAlignment>
<LangVersion>9</LangVersion>
<Deterministic>true</Deterministic>
<WrathInstallDir Condition="$(WrathInstallDir) == ''">$(WrathPath)</WrathInstallDir>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
Expand Down Expand Up @@ -51,54 +52,57 @@
<Target Name="CreateLib" BeforeTargets="BeforeBuild" AfterTargets="RemoveLib" Condition="!Exists('$(SolutionDir)lib')">
<MakeDir Directories="$(SolutionDir)lib" />
</Target>
<Target Name="CreateZip" AfterTargets="Build">
<ZipDirectory SourceDirectory="$(MSBuildProjectDirectory)\$(OutputPath)" DestinationFile="$(MSBuildProjectDirectory)\$(OutputPath)\..\$(AssemblyName)-$(Version).zip" Overwrite="true" />
</Target>
<Target Name="Publicise" AfterTargets="CreateLib">
<ItemGroup>
<PubliciseAssemblyCSharp Include="$(WrathPath)\Wrath_Data\Managed\Assembly-CSharp.dll" />
<PubliciseUniRx Include="$(WrathPath)\Wrath_Data\Managed\UniRx.dll" />
<PubliciseRuntimeUI Include="$(WrathPath)\Wrath_Data\Managed\Owlcat.Runtime.UI.dll" />
<PubliciseAssemblyCSharp Include="$(WrathInstallDir)\Wrath_Data\Managed\Assembly-CSharp.dll" />
<PubliciseUniRx Include="$(WrathInstallDir)\Wrath_Data\Managed\UniRx.dll" />
<PubliciseRuntimeUI Include="$(WrathInstallDir)\Wrath_Data\Managed\Owlcat.Runtime.UI.dll" />
</ItemGroup>
<Publicise InputAssemblies="@(PubliciseAssemblyCSharp)" OutputPath="$(SolutionDir)lib/" PubliciseCompilerGenerated="true" />
<Publicise InputAssemblies="@(PubliciseUniRx)" OutputPath="$(SolutionDir)lib/" PubliciseCompilerGenerated="true" />
<Publicise InputAssemblies="@(PubliciseRuntimeUI)" OutputPath="$(SolutionDir)lib/" PubliciseCompilerGenerated="true" />
</Target>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(WrathPath)\Wrath_Data\Managed\0Harmony.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>$(SolutionDir)lib\Assembly-CSharp_public.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>$(WrathPath)\Wrath_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Owlcat.Runtime.Visual">
<HintPath>$(WrathPath)\Wrath_Data\Managed\Owlcat.Runtime.Visual.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\Owlcat.Runtime.Visual.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="TabletopTweaks-Core">
<HintPath>$(WrathPath)\Mods\TabletopTweaks-Core\TabletopTweaks-Core.dll</HintPath>
<HintPath>$(WrathInstallDir)\Mods\TabletopTweaks-Core\TabletopTweaks-Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Newtonsoft.Json">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(WrathPath)\Wrath_Data\Managed\Newtonsoft.Json.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Owlcat.Runtime.Core">
<HintPath>$(WrathPath)\Wrath_Data\Managed\Owlcat.Runtime.Core.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\Owlcat.Runtime.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Owlcat.Runtime.UI">
<HintPath>$(SolutionDir)\lib\Owlcat.Runtime.UI_public.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Owlcat.Runtime.Validation">
<HintPath>$(WrathPath)\Wrath_Data\Managed\Owlcat.Runtime.Validation.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\Owlcat.Runtime.Validation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand All @@ -116,47 +120,51 @@
<Private>False</Private>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>$(WrathPath)\Wrath_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.UI.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityModManager">
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityModManager\UnityModManager.dll</HintPath>
<HintPath>$(WrathInstallDir)\Wrath_Data\Managed\UnityModManager\UnityModManager.dll</HintPath>
<Private>False</Private>
</Reference>
<PackageReference Include="Aze.Publicise.MSBuild.Task" Version="1.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Bugfixes\Abilities\BaseAbilities.cs" />
Expand Down Expand Up @@ -950,13 +958,7 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" AfterTargets="BeforeClean">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Aze.Publicise.MSBuild.Task.1.0.0\build\Aze.Publicise.MSBuild.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Aze.Publicise.MSBuild.Task.1.0.0\build\Aze.Publicise.MSBuild.Task.props'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>(robocopy "$(TargetDir) " "%25WrathPath%25\Mods\TabletopTweaks-Base\ " /s /e )^&amp; IF %25ERRORLEVEL%25 LEQ 1 exit 0</PostBuildEvent>
<PostBuildEvent>(robocopy "$(TargetDir) " "$(WrathInstallDir)\Mods\TabletopTweaks-Base\ " /s /e )^&amp; IF %25ERRORLEVEL%25 LEQ 1 exit 0</PostBuildEvent>
</PropertyGroup>
</Project>