11name : Build
22
3- on :
3+ on :
44 # Trigger on push to main, dev
55 push :
66 branches : [ main, dev ]
77 # Trigger on any PR
8- pull_request :
8+ pull_request :
99
1010jobs :
1111 grab-reference-assemblies :
@@ -16,15 +16,15 @@ jobs:
1616 uses : actions/checkout@v4
1717
1818 - name : Cache Unity project
19- uses : actions/cache@v3
19+ uses : actions/cache@v4
2020 with :
2121 path : ./UnityProject/Library
2222 key : Library-UnityNetcodePatcher-linux-x64
2323 restore-keys : |
2424 Library-UnityNetcodePatcher-
2525 Library-
26-
27- - name : Restore Unity project
26+
27+ - name : Restore Unity project
2828 uses : game-ci/unity-builder@v4
2929 env :
3030 UNITY_LICENSE : ${{ secrets.UNITY_LICENSE }}
4141 sudo apt-get install tree
4242 tree ./UnityProject/Library/ScriptAssemblies/
4343 tree ./UnityProject/UnityEditor
44-
44+
4545 - name : Upload assemblies as build artifact
4646 uses : actions/upload-artifact@v4
4747 with :
5050 UnityProject/Library/ScriptAssemblies/
5151 UnityProject/UnityEditor/
5252
53- build :
54- name : Build for ${{ matrix.target }}
53+ build-patchers :
54+ name : Build patcher for Netcode ${{ matrix.netcode-version }}
5555 needs : grab-reference-assemblies
56+ runs-on : ubuntu-latest
57+ strategy :
58+ fail-fast : false
59+ matrix :
60+ netcode-version : [ "1.5.2", "1.6.0", "1.7.0", "1.7.1", "1.8.0", "1.8.1"]
61+ steps :
62+ - name : Fetch Sources
63+ uses : actions/checkout@v4
64+ with :
65+ fetch-depth : 0
66+ filter : tree:0
67+ submodules : recursive
68+
69+ - name : Fetch Reference Assemblies
70+ uses : actions/download-artifact@v4
71+ with :
72+ name : reference-assemblies
73+ path : UnityProject/
74+
75+ - uses : actions/setup-dotnet@v4
76+ with :
77+ dotnet-version : " 8.0.*"
78+
79+ - name : Build patcher
80+ shell : bash
81+ run : |
82+ dotnet publish NetcodePatcher/NetcodePatcher.csproj -c Release -p:UnityNetcodeVersion="${{ matrix.netcode-version }}" -p:UnityEditorDir="${{ github.workspace }}/UnityProject/UnityEditor"
83+
84+ - name : Upload assembly artifacts
85+ uses : actions/upload-artifact@v4
86+ with :
87+ name : nv${{ matrix.netcode-version }}-patcher-assemblies
88+ path : " ./NetcodePatcher/bin/Release/netstandard2.1/publish/**/*"
89+
90+ - name : Pack patcher
91+ shell : bash
92+ run : |
93+ dotnet pack NetcodePatcher/NetcodePatcher.csproj -c Release -p:UnityNetcodeVersion="${{ matrix.netcode-version }}" -p:UnityEditorDir="${{ github.workspace }}/UnityProject/UnityEditor"
94+
95+ - name : Upload nupkg artifacts
96+ uses : actions/upload-artifact@v4
97+ with :
98+ name : nv${{ matrix.netcode-version }}-patcher-nupkg-build
99+ path : " ./NetcodePatcher/bin/Release/*.nupkg"
100+
101+ build-cli-binaries :
102+ name : Build CLI for ${{ matrix.target }}
103+ needs : build-patchers
56104 runs-on : ${{ matrix.os }}
57105 strategy :
58106 fail-fast : false
@@ -75,38 +123,97 @@ jobs:
75123 fetch-depth : 0
76124 filter : tree:0
77125 submodules : recursive
78-
79- - name : Fix symbolic link
80- if : ${{ matrix.kind == 'windows' }}
81- shell : cmd
126+
127+ - name : Fetch Patcher Assemblies
128+ uses : actions/download-artifact@v4
129+ with :
130+ pattern : nv*-patcher-assemblies
131+ merge-multiple : true
132+ path : ./NetcodePatcher/bin/Release/netstandard2.1/publish
133+
134+ - uses : actions/setup-dotnet@v4
135+ with :
136+ dotnet-version : " 8.0.*"
137+
138+ - name : Build CLI binary
139+ shell : bash
82140 run : |
83- del .\NetcodePatcher\Unity\Netcode\Editor\CodeGen
84- mklink /j .\NetcodePatcher\Unity\Netcode\Editor\CodeGen .\submodules\com.unity.netcode.gameobjects\com.unity.netcode.gameobjects\Editor\CodeGen
85-
86- - name : Fetch Reference Assemblies
141+ dotnet build NetcodePatcher.Cli/NetcodePatcher.Cli.csproj -c ReleaseTools -t:CreateZip -r "${{ matrix.target }}" --self-contained true -f net8.0
142+
143+ - name : Upload platform binary artifacts
144+ uses : actions/upload-artifact@v4
145+ with :
146+ name : cli-${{ matrix.target }}-zip-build
147+ path : " ./NetcodePatcher.Cli/bin/ReleaseTools/net8.0/${{ matrix.target }}/*.zip"
148+
149+ build-cli-nupkg :
150+ name : Build CLI .nupkg
151+ needs : build-patchers
152+ runs-on : ubuntu-latest
153+ steps :
154+ - name : Fetch Sources
155+ uses : actions/checkout@v4
156+ with :
157+ fetch-depth : 0
158+ filter : tree:0
159+ submodules : recursive
160+
161+ - name : Fetch Patcher Assemblies
87162 uses : actions/download-artifact@v4
88163 with :
89- name : reference-assemblies
90- path : UnityProject/
164+ pattern : nv*-patcher-assemblies
165+ merge-multiple : true
166+ path : ./NetcodePatcher/bin/Release/netstandard2.1/publish
91167
92- - uses : actions/setup-dotnet@v3
168+ - uses : actions/setup-dotnet@v4
93169 with :
94- dotnet-version : " 8.0.100 "
95-
96- - name : Build solution
170+ dotnet-version : " 8.0.* "
171+
172+ - name : Pack CLI nupkg
97173 shell : bash
98174 run : |
99- dotnet pack -p:UnityEditorDir="${{ github.workspace }}/UnityProject/UnityEditor" -p:TargetPlatformName="${{ matrix.target }}"
175+ dotnet pack NetcodePatcher.Cli/NetcodePatcher.Cli.csproj -c ReleaseTools
100176
101- - name : Upload manual install artifacts
177+ - name : Upload nupkg artifact
102178 uses : actions/upload-artifact@v4
103179 with :
104- name : plain-build-${{ matrix.target }}
105- path : " ./NetcodePatcher.Cli/dist/*.zip"
180+ name : cli-nupkg-build
181+ path : " ./NetcodePatcher.Cli/bin/ReleaseTools/*.nupkg"
182+
183+ build-msbuild-nupkg :
184+ name : Build NetcodePatcher.MSBuild
185+ needs : build-patchers
186+ runs-on : ubuntu-latest
187+ steps :
188+ - name : Fetch Sources
189+ uses : actions/checkout@v4
190+ with :
191+ fetch-depth : 0
192+ filter : tree:0
193+ submodules : recursive
194+
195+ - name : Fetch Patcher Assemblies
196+ uses : actions/download-artifact@v4
197+ with :
198+ pattern : nv*-patcher-assemblies
199+ merge-multiple : true
200+ path : ./NetcodePatcher/bin/Release/netstandard2.1/publish
201+
202+ - uses : actions/setup-dotnet@v4
203+ with :
204+ dotnet-version : " 8.0.*"
205+
206+ - name : Build MSBuild tasks
207+ run : |
208+ dotnet build NetcodePatcher.MSBuild.Tasks/NetcodePatcher.MSBuild.Tasks.csproj -c Release
209+
210+ - name : Build MSBuild package
211+ shell : bash
212+ run : |
213+ dotnet pack NetcodePatcher.MSBuild/NetcodePatcher.MSBuild.csproj -c ReleaseTools
106214
107- - name : Upload nupkg Artifacts
108- if : ${{ matrix.kind == 'linux' }}
215+ - name : Upload nupkg artifact
109216 uses : actions/upload-artifact@v4
110217 with :
111- name : nupkg-build
112- path : " ./NetcodePatcher* /bin/* /*.nupkg"
218+ name : msbuild- nupkg-build
219+ path : " ./NetcodePatcher.MSBuild /bin/ReleaseTools /*.nupkg"
0 commit comments