4141 VERSION_SUFFIX : -beta
4242
4343jobs :
44+ generate-keys :
45+ name : Generate Version-Specific Network Keys
46+ runs-on : ubuntu-latest
47+ steps :
48+ - name : Checkout Code
49+ uses : actions/checkout@v4
50+ with :
51+ submodules : recursive
52+
53+ - name : Cache binaries
54+ uses : actions/cache@v3
55+ id : cache-binaries
56+ with :
57+ key : ${{ runner.os }}-binaries-${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}-${{ hashFiles('Intersect*/**/*.cs*') }}
58+ path : |
59+ Intersect*/bin/Release/**/*
60+
61+ - name : Setup dotnet
62+ if : steps.cache-binaries.outputs.cache-hit != 'true' || inputs.forceBuild == true || inputs.forceRestore == true
63+ uses : actions/setup-dotnet@v3
64+ with :
65+ dotnet-version : 7.0.x
66+
67+ - name : Cache NuGet dependencies
68+ uses : actions/cache@v3
69+ id : cache-nuget
70+ if : steps.cache-binaries.outputs.cache-hit != 'true' || inputs.forceBuild == true || inputs.forceRestore == true
71+ with :
72+ key : ${{ runner.os }}-nuget-${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}-${{ hashFiles('Intersect*/*.csproj') }}
73+ path : |
74+ ~/.nuget/packages
75+ Intersect*/obj/
76+
77+ - name : Restore NuGet Packages
78+ if : steps.cache-binaries.outputs.cache-hit != 'true' && steps.cache-nuget.outputs.cache-hit != 'true' || inputs.forceRestore == true
79+ run : dotnet restore Intersect.sln
80+
81+ - name : Build Intersect.Network
82+ if : steps.cache-binaries.outputs.cache-hit != 'true' || inputs.forceBuild == true || inputs.forceRestore == true
83+ run : dotnet build Intersect.Network/Intersect.Network.csproj --sc -r linux-x64 -p:Configuration=Release -p:PackageVersion=${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}.${{ github.run_number }}+build.${{ github.sha }} -p:Version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}
84+
85+ - name : Debug files on disk
86+ if : inputs.workflowDebug == true
87+ run : ls -R .
88+
89+ - name : Upload keys
90+ uses : actions/upload-artifact@v3
91+ with :
92+ if-no-files-found : error
93+ name : keys
94+ path : |
95+ ./Intersect.Network/bin/Release/keys/*
96+
4497 build-linux :
4598 name : Build for Linux
99+ needs : [generate-keys]
46100 runs-on : ubuntu-latest
47101 steps :
48102 - name : Checkout Code
@@ -81,6 +135,15 @@ jobs:
81135 if : steps.cache-binaries.outputs.cache-hit != 'true' && steps.cache-nuget.outputs.cache-hit != 'true' || inputs.forceRestore == true
82136 run : dotnet restore Intersect.sln
83137
138+ - name : Download keys
139+ uses : actions/download-artifact@v3
140+ with :
141+ name : keys
142+ path : .
143+
144+ - name : Debug keys
145+ run : ls -R ./Intersect.Network/bin/Release/keys
146+
84147 - name : Build solution
85148 if : steps.cache-binaries.outputs.cache-hit != 'true' || inputs.forceBuild == true || inputs.forceRestore == true
86149 run : dotnet publish Intersect.sln --sc -r linux-x64 -p:Configuration=Release -p:PackageVersion=${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}.${{ github.run_number }}+build.${{ github.sha }} -p:Version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}
@@ -101,6 +164,7 @@ jobs:
101164
102165 build-macos :
103166 name : Build for MacOS
167+ needs : [generate-keys]
104168 runs-on : macos-latest
105169 steps :
106170 - name : Checkout Code
@@ -139,6 +203,15 @@ jobs:
139203 if : steps.cache-binaries.outputs.cache-hit != 'true' && steps.cache-nuget.outputs.cache-hit != 'true' || inputs.forceRestore == true
140204 run : dotnet restore Intersect.sln
141205
206+ - name : Download keys
207+ uses : actions/download-artifact@v3
208+ with :
209+ name : keys
210+ path : .
211+
212+ - name : Debug keys
213+ run : ls -R ./Intersect.Network/bin/Release/keys
214+
142215 - name : Build solution
143216 if : steps.cache-binaries.outputs.cache-hit != 'true' || inputs.forceBuild == true || inputs.forceRestore == true
144217 run : dotnet publish Intersect.sln --sc -r osx-x64 -p:Configuration=Release -p:PackageVersion=${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}.${{ github.run_number }}+build.${{ github.sha }} -p:Version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}
@@ -159,6 +232,7 @@ jobs:
159232
160233 build-windows :
161234 name : Build for Windows
235+ needs : [generate-keys]
162236 runs-on : windows-latest
163237 steps :
164238 - name : Checkout Code
@@ -197,6 +271,15 @@ jobs:
197271 if : steps.cache-binaries.outputs.cache-hit != 'true' && steps.cache-nuget.outputs.cache-hit != 'true' || inputs.forceRestore == true
198272 run : dotnet restore Intersect.sln
199273
274+ - name : Download keys
275+ uses : actions/download-artifact@v3
276+ with :
277+ name : keys
278+ path : .
279+
280+ - name : Debug keys
281+ run : ls -R ./Intersect.Network/bin/Release/keys
282+
200283 - name : Build solution
201284 if : steps.cache-binaries.outputs.cache-hit != 'true' || inputs.forceBuild == true || inputs.forceRestore == true
202285 run : dotnet publish Intersect.sln --sc -r win-x64 -p:Configuration=Release -p:PackageVersion=${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}.${{ github.run_number }}+build.${{ github.sha }} -p:Version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}
0 commit comments