@@ -27,23 +27,55 @@ jobs:
2727 repository : optiscaler/OptiScaler
2828 ref : master
2929 path : optiscaler-source
30+ submodules : ' true' # Important: check out submodules like upstream
3031
31- - name : Get OptiScaler commit info
32- id : optiscaler_info
32+ - name : Extract version from resource.h
33+ id : extract_version
3334 shell : powershell
3435 run : |
3536 cd optiscaler-source
37+
38+ # Read resource.h to extract version information
39+ $resourceFile = "OptiScaler\resource.h"
40+ if (-not (Test-Path $resourceFile)) {
41+ Write-Error "resource.h not found at $resourceFile"
42+ exit 1
43+ }
44+
45+ $content = Get-Content $resourceFile
46+
47+ # Extract version components (following upstream pattern)
48+ $majorMatch = $content | Select-String '#define\s+VER_FILE_VERSION_MAJOR\s+(\d+)'
49+ $minorMatch = $content | Select-String '#define\s+VER_FILE_VERSION_MINOR\s+(\d+)'
50+ $patchMatch = $content | Select-String '#define\s+VER_FILE_VERSION_PATCH\s+(\d+)'
51+ $buildMatch = $content | Select-String '#define\s+VER_FILE_VERSION_BUILD\s+(\d+)'
52+
53+ if (-not $majorMatch -or -not $minorMatch -or -not $patchMatch -or -not $buildMatch) {
54+ Write-Error "Could not extract all version components from resource.h"
55+ exit 1
56+ }
57+
58+ $major = $majorMatch.Matches[0].Groups[1].Value
59+ $minor = $minorMatch.Matches[0].Groups[1].Value
60+ $patch = $patchMatch.Matches[0].Groups[1].Value
61+ $build = $buildMatch.Matches[0].Groups[1].Value
62+
63+ $version = "$major.$minor.$patch.$build"
64+
65+ # Get commit info
3666 $commitSha = git rev-parse HEAD
3767 $shortSha = git rev-parse --short HEAD
38- $commitDate = Get-Date -Format "yyyyMMdd"
68+ $commitDate = Get-Date -Format "yyyyMMdd-HHmm "
3969
70+ Write-Output "Extracted version: $version"
4071 Write-Output "OptiScaler HEAD SHA: $commitSha"
4172 Write-Output "Short SHA: $shortSha"
4273 Write-Output "Commit Date: $commitDate"
4374
44- # Create a unique release name
45- $releaseName = "OptiScaler-Source -$commitDate-$shortSha"
75+ # Create version-based release name (following upstream pattern)
76+ $releaseName = "source-v$version -$commitDate-$shortSha"
4677
78+ echo "version=$version" >> $env:GITHUB_OUTPUT
4779 echo "commit_sha=$commitSha" >> $env:GITHUB_OUTPUT
4880 echo "short_sha=$shortSha" >> $env:GITHUB_OUTPUT
4981 echo "commit_date=$commitDate" >> $env:GITHUB_OUTPUT
@@ -52,23 +84,14 @@ jobs:
5284 - name : Setup MSBuild
5385 uses : microsoft/setup-msbuild@v2
5486
55- - name : Setup NuGet
56- uses : NuGet/setup-nuget@v2
57-
58- - name : Restore OptiScaler dependencies
87+ - name : Build OptiScaler (following upstream approach)
5988 shell : powershell
6089 run : |
6190 cd optiscaler-source
62- Write-Output "Restoring NuGet packages..."
63- nuget restore OptiScaler.sln
64-
65- - name : Build OptiScaler
66- shell : powershell
67- run : |
68- cd optiscaler-source
69- Write-Output "Building OptiScaler..."
91+ Write-Output "Building OptiScaler following upstream approach..."
7092
71- # Build the solution
93+ # Use the same build approach as upstream just_build.yml
94+ # Build Release x64 configuration
7295 msbuild OptiScaler.sln /p:Configuration=Release /p:Platform=x64 /m
7396
7497 if ($LASTEXITCODE -ne 0) {
@@ -77,12 +100,61 @@ jobs:
77100 }
78101
79102 Write-Output "Build completed successfully!"
103+
104+ # Verify the main output exists
105+ $mainDll = "x64\Release\OptiScaler.dll"
106+ if (-not (Test-Path $mainDll)) {
107+ Write-Error "Main output OptiScaler.dll not found at $mainDll"
108+ exit 1
109+ }
110+
111+ - name : Verify build outputs and organize artifacts
112+ shell : powershell
113+ run : |
114+ cd optiscaler-source
115+ $version = "${{ steps.extract_version.outputs.version }}"
116+
117+ Write-Output "=== Build Output Verification ==="
118+
119+ # Check for expected outputs
120+ $expectedFiles = @(
121+ "x64\Release\OptiScaler.dll"
122+ )
123+
124+ $missingFiles = @()
125+ foreach ($file in $expectedFiles) {
126+ if (Test-Path $file) {
127+ $fileInfo = Get-Item $file
128+ Write-Output "✅ Found: $file ($($fileInfo.Length) bytes)"
129+ } else {
130+ $missingFiles += $file
131+ Write-Output "❌ Missing: $file"
132+ }
133+ }
134+
135+ if ($missingFiles.Count -gt 0) {
136+ Write-Error "Missing required build outputs: $($missingFiles -join ', ')"
137+ exit 1
138+ }
139+
140+ # List all files in the release directory for transparency
141+ Write-Output "=== All files in Release directory ==="
142+ Get-ChildItem -Path "x64\Release" -Recurse | ForEach-Object {
143+ if ($_.PSIsContainer) {
144+ Write-Output "📁 $($_.FullName.Replace($PWD, '.'))"
145+ } else {
146+ Write-Output "📄 $($_.FullName.Replace($PWD, '.')) ($($_.Length) bytes)"
147+ }
148+ }
149+
150+ Write-Output "=== Build verification completed successfully ==="
80151
81152 - name : Package OptiScaler build artifacts
82153 shell : powershell
83154 run : |
84- $commitDate = "${{ steps.optiscaler_info.outputs.commit_date }}"
85- $shortSha = "${{ steps.optiscaler_info.outputs.short_sha }}"
155+ $commitDate = "${{ steps.extract_version.outputs.commit_date }}"
156+ $shortSha = "${{ steps.extract_version.outputs.short_sha }}"
157+ $version = "${{ steps.extract_version.outputs.version }}"
86158
87159 # Create artifact directory
88160 $artifactDir = "${{ github.workspace }}\x64\Release\a"
@@ -106,21 +178,26 @@ jobs:
106178 Write-Output "Copied $($file.Name)"
107179 }
108180
109- # Create a comprehensive archive of the build
110- $archiveName = "OptiScaler-Source -$commitDate-$shortSha.7z"
181+ # Create a comprehensive 7z archive following upstream pattern
182+ $archiveName = "OptiScaler-v$version-source -$commitDate-$shortSha.7z"
111183 $archivePath = "$artifactDir\$archiveName"
112184
113- # Use 7z to create archive if available, otherwise use PowerShell compression
114- try {
115- $7zPath = Get-Command "7z.exe" -ErrorAction Stop
116- & $7zPath a -t7z "$archivePath" "$sourceDir\*"
185+ # Install 7-Zip first (following upstream approach)
186+ Write-Output "Installing 7-Zip..."
187+ Invoke-WebRequest -Uri "https://www.7-zip.org/a/7z2301-x64.exe" -OutFile "7z-installer.exe"
188+ Start-Process -FilePath "7z-installer.exe" -ArgumentList "/S" -Wait
189+
190+ # Add 7-Zip to PATH
191+ $env:PATH += ";C:\Program Files\7-Zip"
192+
193+ # Create 7z archive
194+ & "C:\Program Files\7-Zip\7z.exe" a -t7z "$archivePath" "$sourceDir\*"
195+
196+ if ($LASTEXITCODE -eq 0) {
117197 Write-Output "Created 7z archive: $archiveName"
118- } catch {
119- # Fallback to ZIP if 7z not available
120- $zipName = "OptiScaler-Source-$commitDate-$shortSha.zip"
121- $zipPath = "$artifactDir\$zipName"
122- Compress-Archive -Path "$sourceDir\*" -DestinationPath $zipPath -Force
123- Write-Output "Created ZIP archive: $zipName (7z not available)"
198+ } else {
199+ Write-Error "Failed to create 7z archive"
200+ exit 1
124201 }
125202
126203 - name : Download latest dlssg-to-fsr3 release
@@ -224,9 +301,13 @@ jobs:
224301 Write-Output " $($_.Name) ($($_.Length) bytes)"
225302 }
226303
227- - name : Prepare release assets
304+ - name : Prepare release assets and create archive
228305 shell : powershell
229306 run : |
307+ $version = "${{ steps.extract_version.outputs.version }}"
308+ $commitDate = "${{ steps.extract_version.outputs.commit_date }}"
309+ $shortSha = "${{ steps.extract_version.outputs.short_sha }}"
310+
230311 # Get list of all files in the artifact directory for individual upload
231312 $artifactDir = "${{ github.workspace }}\x64\Release\a"
232313 $files = Get-ChildItem -Path $artifactDir -File
@@ -244,6 +325,11 @@ jobs:
244325 $filesJson = $fileList | ConvertTo-Json -Compress
245326 echo "files_to_upload=$filesJson" >> $env:GITHUB_OUTPUT
246327 echo "files_count=$($fileList.Count)" >> $env:GITHUB_OUTPUT
328+
329+ # Create a comprehensive archive name following upstream pattern
330+ $archiveName = "OptiScaler-v$version-source-complete-$commitDate-$shortSha.7z"
331+ Write-Output "Archive name: $archiveName"
332+ echo "archive_name=$archiveName" >> $env:GITHUB_OUTPUT
247333 id : prepare_assets
248334
249335 - name : Get component versions
@@ -270,25 +356,26 @@ jobs:
270356 env :
271357 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
272358 with :
273- tag_name : ${{ steps.optiscaler_info .outputs.release_name }}
274- release_name : ${{ steps.optiscaler_info .outputs.release_name }} - Source Build
359+ tag_name : ${{ steps.extract_version .outputs.release_name }}
360+ release_name : ${{ steps.extract_version .outputs.release_name }} - Source Build
275361 body : |
276362 🔨 **Source Build Release**
277363
278364 This release contains OptiScaler built from the latest source code, combined with the latest versions of complementary tools.
279365
280366 ## 📦 Components Included
281367
282- - **OptiScaler**: Built from source at commit [`${{ steps.optiscaler_info .outputs.commit_sha }}`](https://github.com/optiscaler/OptiScaler/commit/${{ steps.optiscaler_info .outputs.commit_sha }})
368+ - **OptiScaler**: v${{ steps.extract_version.outputs.version }} built from source at commit [`${{ steps.extract_version .outputs.commit_sha }}`](https://github.com/optiscaler/OptiScaler/commit/${{ steps.extract_version .outputs.commit_sha }})
283369 - **dlssg-to-fsr3**: ${{ steps.get_versions.outputs.dlssg_version }} - `dlssg_to_fsr3_amd_is_better.dll`
284370 - **fakenvapi**: ${{ steps.get_versions.outputs.fakenvapi_version }} - `nvapi64.dll` and `fakenvapi.ini`
285371
286372 ## 🔧 Build Information
287373
288374 - **Source Repository**: [OptiScaler](https://github.com/optiscaler/OptiScaler)
289375 - **Branch**: master
290- - **Commit SHA**: `${{ steps.optiscaler_info.outputs.commit_sha }}`
291- - **Build Date**: ${{ steps.optiscaler_info.outputs.commit_date }}
376+ - **Version**: ${{ steps.extract_version.outputs.version }}
377+ - **Commit SHA**: `${{ steps.extract_version.outputs.commit_sha }}`
378+ - **Build Date**: ${{ steps.extract_version.outputs.commit_date }}
292379 - **Trigger**: `${{ github.event_name }}`
293380
294381 ## ⚠️ Important Notes
@@ -309,7 +396,7 @@ jobs:
309396
310397 **Workflow Information:**
311398 - Build Workflow: [View Details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
312- - Built with: MSBuild on Windows
399+ - Built with: MSBuild on Windows following upstream approach
313400 draft : false
314401 prerelease : true
315402 id : create_release
@@ -360,6 +447,30 @@ jobs:
360447
361448 Write-Output "🎉 All source build files uploaded successfully!"
362449
450+ - name : Build Summary
451+ shell : powershell
452+ run : |
453+ Write-Output "=== 🚀 BUILD SUMMARY ==="
454+ Write-Output ""
455+ Write-Output "✅ Source Build Completed Successfully"
456+ Write-Output ""
457+ Write-Output "📦 Release Information:"
458+ Write-Output " • Tag: ${{ steps.extract_version.outputs.release_name }}"
459+ Write-Output " • Version: ${{ steps.extract_version.outputs.version }}"
460+ Write-Output " • Commit: ${{ steps.extract_version.outputs.commit_sha }}"
461+ Write-Output " • Build Date: ${{ steps.extract_version.outputs.commit_date }}"
462+ Write-Output ""
463+ Write-Output "🔧 Components Included:"
464+ Write-Output " • OptiScaler v${{ steps.extract_version.outputs.version }} (built from source)"
465+ Write-Output " • dlssg-to-fsr3 ${{ steps.get_versions.outputs.dlssg_version }}"
466+ Write-Output " • fakenvapi ${{ steps.get_versions.outputs.fakenvapi_version }}"
467+ Write-Output ""
468+ Write-Output "📄 Files Uploaded: ${{ steps.prepare_assets.outputs.files_count }}"
469+ Write-Output ""
470+ Write-Output "🎯 Release URL: ${{ steps.create_release.outputs.html_url }}"
471+ Write-Output ""
472+ Write-Output "=== ✨ Ready for Testing! ==="
473+
363474 - name : Update repository description
364475 shell : powershell
365476 run : |
@@ -370,7 +481,7 @@ jobs:
370481 }
371482
372483 $body = @{
373- description = "🚀 Automated releases for OptiScaler | Latest Source: ${{ steps.optiscaler_info .outputs.release_name }}"
484+ description = "🚀 Automated releases for OptiScaler | Latest Source: ${{ steps.extract_version .outputs.release_name }}"
374485 } | ConvertTo-Json
375486
376487 try {
0 commit comments