Skip to content

build: create unified Aurora package #5

build: create unified Aurora package

build: create unified Aurora package #5

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Build Aurora (No Signing) / 构建 Aurora(未签名)
on:
workflow_dispatch:
push:
branches: [ "aurora" ]
# pull_request:
# branches: [ "master" ]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .
# Configuration type to build.
BUILD_CONFIGURATION: Release
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
environment: Build
steps:
- name: Checkout / 检出源码
uses: actions/checkout@v6
with:
submodules: 'true'
- name: Extract version / 读取版本号
id: get_version
working-directory: ${{ github.workspace }}
shell: powershell
run: |
$resourceFile = ".\OptiScaler\resource.h"
if (-Not (Test-Path $resourceFile)) {
Write-Error "File not found: $resourceFile"
exit 1
}
function Get-Version-Component {
param (
[string]$pattern,
[string]$replacement
)
$line = Get-Content $resourceFile | Select-String -Pattern $pattern | Select-Object -First 1
if ($line) {
return ($line.Line -replace $replacement).Trim()
}
Write-Error "Pattern not found: $pattern"
exit 1
}
$majorVersion = Get-Version-Component 'VER_MAJOR_VERSION' '#define VER_MAJOR_VERSION\s+'
$minorVersion = Get-Version-Component 'VER_MINOR_VERSION' '#define VER_MINOR_VERSION\s+'
$hotfixVersion = Get-Version-Component 'VER_HOTFIX_VERSION' '#define VER_HOTFIX_VERSION\s+'
$buildVersion = Get-Version-Component 'VER_BUILD_NUMBER' '#define VER_BUILD_NUMBER\s+'
$resourceLines = Get-Content $resourceFile
$devRelease = $resourceLines | Select-String -Pattern '^\s*#define\s+VER_DEV_RELEASE' -Quiet
$forkLine = $resourceLines | Select-String -Pattern '^\s*#define\s+VER_FORK_TAG' | Select-Object -First 1
$forkTag = ''
if ($forkLine) { $forkTag = ($forkLine.Line -replace '.*"(.*)".*', '$1') }
if ($devRelease) { $suffix = "-dev" } else { $suffix = "-pre$buildVersion" }
$version = "v$majorVersion.$minorVersion.$hotfixVersion$suffix$forkTag"
$date = Get-Date -Format "yyyyMMdd"
$outputFileName = "OptiScaler_Aurora_${version}_${date}"
Write-Output "Generated Filename: $outputFileName"
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"filename=$outputFileName" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
continue-on-error: false
- name: Debug outputs / 检查版本信息
run: |
echo "Version: ${{ steps.get_version.outputs.version }}"
echo "Filename: ${{ steps.get_version.outputs.filename }}"
- name: Add MSBuild to PATH / 配置 MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build / 构建
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} /verbosity:minimal
- name: Add README / 添加说明文档
run: Copy-Item ${{ github.workspace }}\dist\README.md ${{ github.workspace }}\x64\Release\a\README.md
# Streamline 2.14 is included in every Aurora package.
- name: Add Streamline 2.14 / 添加 Streamline 2.14
shell: powershell
run: |
$target = "${{ github.workspace }}\x64\Release\a\OptiScaler\streamline"
New-Item -ItemType Directory -Force -Path $target | Out-Null
Copy-Item ${{ github.workspace }}\dist\streamline\* $target
# DLSS 310.9 snippets already tracked in dist/nvngx are included in every Aurora package.
- name: Add DLSS 310.9 snippets / 添加 DLSS 310.9 运行库
shell: powershell
run: |
$target = "${{ github.workspace }}\x64\Release\a\OptiScaler"
New-Item -ItemType Directory -Force -Path $target | Out-Null
Copy-Item ${{ github.workspace }}\dist\nvngx\* $target
# nvngx_dlssnr.dll is too large for normal Git and public forks cannot upload new LFS objects.
# Keep it as a dedicated Release asset, download it at build time, and verify the exact tested file.
- name: Add DLSS Neural Rendering runtime / 添加 DLSS 神经渲染运行库
shell: powershell
run: |
$url = "https://github.com/abc354402600/OptiScaler-Community-Fixes/releases/download/aurora-runtime-dlssnr-310.8/nvngx_dlssnr.dll"
$target = "${{ github.workspace }}\x64\Release\a\OptiScaler\nvngx_dlssnr.dll"
$expectedSha256 = "e67dee209320cdafe0e93e45675d7aa34323a53acc57a72b2e40a181581c989a"
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $url -OutFile $target
$actualSha256 = (Get-FileHash $target -Algorithm SHA256).Hash.ToLowerInvariant()
if ($actualSha256 -ne $expectedSha256) {
Write-Error "nvngx_dlssnr.dll SHA256 mismatch. Expected $expectedSha256, got $actualSha256"
exit 1
}
Write-Output "DLSS Neural Rendering runtime verified: $actualSha256"
- name: Package Aurora / 打包 Aurora
shell: powershell
run: |
$zipName = "${{ steps.get_version.outputs.filename }}.7z"
7z a -r ${{ github.workspace }}\$zipName ${{ github.workspace }}\x64\Release\a\*.*
continue-on-error: false
- name: Upload Aurora artifact / 上传 Aurora 构建产物
uses: actions/upload-artifact@v7.0.0
with:
name: '${{ steps.get_version.outputs.filename }}'
path: '${{ github.workspace }}\${{ steps.get_version.outputs.filename }}.7z'
archive: false
compression-level: 0
if-no-files-found: error