Skip to content

Commit 593ea55

Browse files
author
Matthew Bate
committed
Workflow updated.
1 parent 56170e6 commit 593ea55

File tree

1 file changed

+226
-52
lines changed

1 file changed

+226
-52
lines changed
Lines changed: 226 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
name: Development Build and Publish
2-
# Description: Build and publish development builds for HawkSync-ServerManager and its components.
1+
name: Development Build and Publish
32
on:
43
push:
54
branches: [ master, main ]
@@ -22,32 +21,87 @@ env:
2221
DOTNET_VERSION: '8.0.x'
2322

2423
jobs:
25-
build:
24+
validate:
25+
name: Validate Release
2626
runs-on: windows-latest
27+
outputs:
28+
version: ${{ steps.get_version.outputs.version }}
29+
dynamic_tag: ${{ steps.gen_tag.outputs.tag }}
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
2736

37+
- name: Get version
38+
id: get_version
39+
shell: pwsh
40+
run: |
41+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
42+
$version = "${{ github.event.inputs.version }}"
43+
echo "version=$version" >> $env:GITHUB_OUTPUT
44+
} else {
45+
$version = "${{ github.ref_name }}" -replace '^v', ''
46+
echo "version=$version" >> $env:GITHUB_OUTPUT
47+
}
48+
echo "Release version: $version"
49+
50+
- name: Generate dynamic tag
51+
id: gen_tag
52+
shell: pwsh
53+
run: |
54+
$latestTag = git describe --tags --abbrev=0
55+
$now = Get-Date -Format "MMddHHmm"
56+
$commit = git rev-parse --short HEAD
57+
$tag = "$latestTag-$now-$commit"
58+
echo "tag=$tag" >> $env:GITHUB_OUTPUT
59+
Write-Host "Generated tag: $tag"
60+
61+
- name: Validate version format
62+
shell: pwsh
63+
run: |
64+
$version = "${{ steps.get_version.outputs.version }}"
65+
if ($version -notmatch '^\d+\.\d+\.\d+$') {
66+
Write-Error "Invalid version format: $version (expected: X.Y.Z)"
67+
exit 1
68+
}
69+
70+
build-and-test:
71+
name: Build and Test
72+
needs: validate
73+
runs-on: windows-latest
74+
2875
steps:
2976
- name: Checkout code
3077
uses: actions/checkout@v4
3178
with:
3279
fetch-depth: 0
3380

34-
- name: Setup .NET 8.0
81+
- name: Setup .NET
3582
uses: actions/setup-dotnet@v4
3683
with:
3784
dotnet-version: ${{ env.DOTNET_VERSION }}
3885

3986
- name: Setup .NET Framework Build Tools
4087
uses: microsoft/setup-msbuild@v2
4188

89+
# Restore and build HawkSyncShared
4290
- name: Restore HawkSyncShared dependencies
4391
run: dotnet restore ${{ env.HAWKSYNCSHARED_PROJECT_PATH }}
4492

4593
- name: Build HawkSyncShared
4694
run: dotnet build ${{ env.HAWKSYNCSHARED_PROJECT_PATH }} --configuration Release
4795

96+
# Restore and build ServerManager
4897
- name: Restore ServerManager dependencies
4998
run: dotnet restore ${{ env.SERVERMANAGER_PROJECT_PATH }}
5099

100+
# Restore and build RemoteClient
101+
- name: Restore RemoteClient dependencies
102+
run: dotnet restore ${{ env.REMOTECLIENT_PROJECT_PATH }}
103+
104+
# Restore and build NetLimiterBridge
51105
- name: Restore and Build NetLimiterBridge (.NET Framework 4.8.1)
52106
run: |
53107
msbuild ${{ env.NETLIMITERBRIDGE_PROJECT_PATH }} `
@@ -58,6 +112,7 @@ jobs:
58112
/p:PlatformTarget=x64 `
59113
/p:RestorePackagesPath=../packages
60114
115+
# Build ServerManager (.NET 8.0)
61116
- name: Build ServerManager (.NET 8.0)
62117
run: |
63118
dotnet build ${{ env.SERVERMANAGER_PROJECT_PATH }} `
@@ -66,11 +121,12 @@ jobs:
66121
/p:UseCommonOutputDirectory=false `
67122
/p:OutputPath=bin/Release/ `
68123
/p:BaseOutputPath=bin/ `
69-
/p:Platform="Any CPU"
70-
71-
- name: Restore RemoteClient dependencies
72-
run: dotnet restore ${{ env.REMOTECLIENT_PROJECT_PATH }}
124+
/p:Platform="Any CPU" `
125+
/p:Version="${{ needs.validate.outputs.version }}" `
126+
/p:AssemblyVersion="${{ needs.validate.outputs.version }}" `
127+
/p:FileVersion="${{ needs.validate.outputs.version }}"
73128
129+
# Build RemoteClient (.NET 8.0)
74130
- name: Build RemoteClient (.NET 8.0)
75131
run: |
76132
dotnet build ${{ env.REMOTECLIENT_PROJECT_PATH }} `
@@ -79,95 +135,213 @@ jobs:
79135
/p:UseCommonOutputDirectory=false `
80136
/p:OutputPath=bin/Release/ `
81137
/p:BaseOutputPath=bin/ `
82-
/p:Platform="Any CPU"
138+
/p:Platform="Any CPU" `
139+
/p:Version="${{ needs.validate.outputs.version }}" `
140+
/p:AssemblyVersion="${{ needs.validate.outputs.version }}" `
141+
/p:FileVersion="${{ needs.validate.outputs.version }}"
83142
84-
- name: Publish ServerManager
143+
# Publish ServerManager
144+
- name: Publish ServerManager (Framework-Dependent)
85145
run: |
86146
dotnet publish ${{ env.SERVERMANAGER_PROJECT_PATH }} `
87147
--configuration Release `
88148
--runtime win-x64 `
89149
--self-contained false `
90-
--output ./publish/ServerManager `
91-
/p:UseCommonOutputDirectory=false
150+
--output ./publish/framework-dependent/ServerManager `
151+
/p:UseCommonOutputDirectory=false `
152+
/p:Version="${{ needs.validate.outputs.version }}" `
153+
/p:PublishReadyToRun=true
92154
93-
- name: Publish RemoteClient
155+
# Publish RemoteClient
156+
- name: Publish RemoteClient (Framework-Dependent)
94157
run: |
95158
dotnet publish ${{ env.REMOTECLIENT_PROJECT_PATH }} `
96159
--configuration Release `
97160
--runtime win-x64 `
98161
--self-contained false `
99-
--output ./publish/RemoteClient `
100-
/p:UseCommonOutputDirectory=false
162+
--output ./publish/framework-dependent/RemoteClient `
163+
/p:UseCommonOutputDirectory=false `
164+
/p:Version="${{ needs.validate.outputs.version }}" `
165+
/p:PublishReadyToRun=true
101166
102-
- name: Copy NetLimiterBridge to ServerManager output
167+
# Copy NetLimiterBridge to both outputs (ServerManager only)
168+
- name: Copy NetLimiterBridge to Framework-Dependent output
103169
shell: pwsh
104170
run: |
105-
New-Item -ItemType Directory -Force -Path ./publish/ServerManager/NetLimiterBridge
171+
New-Item -ItemType Directory -Force -Path ./publish/framework-dependent/ServerManager/NetLimiterBridge
106172
Copy-Item -Path ./NetLimiterBridge/bin/Release/* `
107-
-Destination ./publish/ServerManager/NetLimiterBridge/ `
173+
-Destination ./publish/framework-dependent/ServerManager/NetLimiterBridge/ `
174+
-Recurse -Force
175+
176+
# Copy HawkSyncShared to both outputs (for both ServerManager and RemoteClient)
177+
- name: Copy HawkSyncShared to Framework-Dependent output
178+
shell: pwsh
179+
run: |
180+
# ServerManager
181+
Copy-Item -Path ./HawkSyncShared/bin/Release/* `
182+
-Destination ./publish/framework-dependent/ServerManager/ `
183+
-Recurse -Force
184+
# RemoteClient
185+
Copy-Item -Path ./HawkSyncShared/bin/Release/* `
186+
-Destination ./publish/framework-dependent/RemoteClient/ `
108187
-Recurse -Force
109188
110-
- name: Create version info
189+
- name: Create release info files
111190
shell: pwsh
112191
run: |
113-
$version = "dev-$(git rev-parse --short HEAD)"
114-
echo "VERSION=$version" >> $env:GITHUB_ENV
115-
116-
@"
192+
$version = "${{ needs.validate.outputs.version }}"
193+
$releaseNotes = @"
194+
HawkSync Server Manager v$version
195+
==================================
196+
117197
Build Information
118-
=================
198+
-----------------
119199
Version: $version
120200
Build Date: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss UTC')
121201
Commit: $(git rev-parse HEAD)
122-
Branch: $($env:GITHUB_REF -replace 'refs/heads/', '')
123-
124-
Components:
202+
Branch: $(git branch --show-current)
203+
204+
Components
205+
----------
125206
- ServerManager (.NET 8.0)
126207
- RemoteClient (.NET 8.0)
127208
- NetLimiterBridge (.NET Framework 4.8.1)
128209
- HawkSyncShared (.NET Standard/.NET 8.0)
129-
130-
Requirements:
210+
211+
Requirements
212+
------------
213+
Framework-Dependent Edition:
131214
- .NET 8.0 Runtime
132215
- .NET Framework 4.8.1 Runtime
133216
- Windows 10/11 (x64)
134-
135-
Download .NET 8.0 Runtime:
136-
https://dotnet.microsoft.com/download/dotnet/8.0
137-
138-
Download .NET Framework 4.8.1 Runtime:
139-
https://dotnet.microsoft.com/download/dotnet-framework/net481
140-
"@ | Out-File -FilePath ./publish/BUILD_INFO.txt
141-
142-
- name: Copy LICENSE to output
217+
- Download .NET 8.0: https://dotnet.microsoft.com/download/dotnet/8.0
218+
- Download .NET Framework 4.8.1: https://dotnet.microsoft.com/download/dotnet-framework/net481
219+
220+
Self-Contained Edition:
221+
- .NET Framework 4.8.1 Runtime (for NetLimiterBridge)
222+
- Windows 10/11 (x64)
223+
- Download .NET Framework 4.8.1: https://dotnet.microsoft.com/download/dotnet-framework/net481
224+
225+
Installation
226+
------------
227+
1. Download your preferred edition below
228+
2. Extract the ZIP file
229+
3. Run ServerManager.exe or RemoteClient.exe
230+
231+
"@
232+
233+
$releaseNotes | Out-File -FilePath ./publish/framework-dependent/RELEASE_NOTES.txt
234+
235+
- name: Copy LICENSE
143236
shell: pwsh
144237
run: |
145238
if (Test-Path "LICENSE.txt") {
146-
Copy-Item LICENSE.txt ./publish/
239+
Copy-Item LICENSE.txt ./publish/framework-dependent/
147240
}
148241
149-
- name: Create ZIP archive
242+
- name: Create release archives
150243
shell: pwsh
151244
run: |
152-
Compress-Archive -Path ./publish/* `
153-
-DestinationPath "./${{ env.OUTPUT_NAME }}-${{ env.VERSION }}.zip"
245+
$version = "${{ needs.validate.outputs.version }}"
154246
155-
- name: Upload Build Artifact
247+
# ServerManager Framework-dependent
248+
Compress-Archive -Path ./publish/framework-dependent/ServerManager/* `
249+
-DestinationPath "./HawkSync-ServerManager-v$version-FrameworkDependent.zip"
250+
251+
# RemoteClient Framework-dependent
252+
Compress-Archive -Path ./publish/framework-dependent/RemoteClient/* `
253+
-DestinationPath "./HawkSync-RemoteClient-v$version-FrameworkDependent.zip"
254+
255+
- name: Generate checksums
256+
shell: pwsh
257+
run: |
258+
$version = "${{ needs.validate.outputs.version }}"
259+
$files = @(
260+
"HawkSync-ServerManager-v$version-FrameworkDependent.zip",
261+
"HawkSync-RemoteClient-v$version-FrameworkDependent.zip"
262+
)
263+
264+
$checksums = @()
265+
foreach ($file in $files) {
266+
$hash = (Get-FileHash $file -Algorithm SHA256).Hash
267+
$checksums += "$hash $file"
268+
}
269+
270+
$checksums | Out-File -FilePath "checksums.txt"
271+
272+
- name: Upload artifacts
156273
uses: actions/upload-artifact@v4
157274
with:
158-
name: ${{ env.OUTPUT_NAME }}-${{ env.VERSION }}
159-
path: ./${{ env.OUTPUT_NAME }}-${{ env.VERSION }}.zip
160-
retention-days: 30
275+
name: release-packages-v${{ needs.validate.outputs.version }}
276+
path: |
277+
./HawkSync-ServerManager-v${{ needs.validate.outputs.version }}-FrameworkDependent.zip
278+
./HawkSync-RemoteClient-v${{ needs.validate.outputs.version }}-FrameworkDependent.zip
279+
./checksums.txt
280+
retention-days: 90
281+
282+
create-release:
283+
name: Create GitHub Release
284+
needs: [validate, build-and-test]
285+
runs-on: windows-latest
286+
287+
steps:
288+
- name: Checkout code
289+
uses: actions/checkout@v4
290+
with:
291+
fetch-depth: 0
292+
293+
- name: Download artifacts
294+
uses: actions/download-artifact@v4
295+
with:
296+
name: release-packages-v${{ needs.validate.outputs.version }}
161297

162-
- name: Create GitHub Pre-release
298+
- name: Create GitHub Release
163299
uses: softprops/action-gh-release@v2
164-
if: github.event_name != 'pull_request'
165300
with:
166-
tag_name: ${{ env.VERSION }}
167-
name: Pre-release Development Build ${{ env.VERSION }}
301+
tag_name: ${{ needs.validate.outputs.dynamic_tag }}
302+
name: Release ${{ needs.validate.outputs.dynamic_tag }}
303+
files: |
304+
./HawkSync-ServerManager-v${{ needs.validate.outputs.version }}-FrameworkDependent.zip
305+
./HawkSync-RemoteClient-v${{ needs.validate.outputs.version }}-FrameworkDependent.zip
306+
./checksums.txt
168307
body: |
169-
This is an automated pre-release development build for commit ${{ env.VERSION }}.
308+
## 🚀 HawkSync Server Manager v${{ needs.validate.outputs.version }}
309+
310+
### 📦 Download Options
311+
312+
- **ServerManager Framework-Dependent** - Requires .NET 8.0 Runtime
313+
- **RemoteClient Framework-Dependent** - Requires .NET 8.0 Runtime
314+
315+
### 🔧 Components
316+
317+
- **ServerManager**: Main application (.NET 8.0)
318+
- **RemoteClient**: Remote client (.NET 8.0)
319+
- **NetLimiterBridge**: Network limiting bridge (.NET Framework 4.8.1)
320+
- **HawkSyncShared**: Shared library (.NET Standard/.NET 8.0)
321+
322+
### ✅ Requirements
323+
324+
**Framework-Dependent Editions:**
325+
- Windows 10/11 (x64)
326+
- [.NET 8.0 Runtime](https://dotnet.microsoft.com/download/dotnet/8.0)
327+
- [.NET Framework 4.8.1 Runtime](https://dotnet.microsoft.com/download/dotnet-framework/net481)
328+
329+
### 📝 Installation
330+
331+
1. Download your preferred edition
332+
2. Extract the ZIP file
333+
3. Run `ServerManager.exe` or `RemoteClient.exe`
334+
335+
### 🔐 Verification
336+
337+
Verify your download using the SHA256 checksums in `checksums.txt`
338+
339+
### 📋 Changes
340+
341+
See the [full changelog](https://github.com/${{ github.repository }}/compare/v${{ needs.validate.outputs.version }}...HEAD)
342+
draft: false
170343
prerelease: true
171-
files: ./${{ env.OUTPUT_NAME }}-${{ env.VERSION }}.zip
344+
make_latest: true
345+
generate_release_notes: true
172346
env:
173347
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)