Skip to content

ci: add fallback inf version macros #9

ci: add fallback inf version macros

ci: add fallback inf version macros #9

Workflow file for this run

name: Build Wintun Artifacts
on:
workflow_dispatch:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
name: Build wintun.dll artifacts
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Resolve Windows SDK version
shell: pwsh
run: |
$sdkRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\Include"
$versions = Get-ChildItem -Path $sdkRoot -Directory |
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
Sort-Object Name -Descending
if (-not $versions) {
throw "No Windows 10 SDK versions found under $sdkRoot"
}
$preferred = $versions | Where-Object { $_.Name -notlike '10.0.26100.*' } | Select-Object -First 1
if (-not $preferred) {
$preferred = $versions | Select-Object -First 1
}
"WINTUN_SDK_VERSION=$($preferred.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
Write-Host "Using WindowsTargetPlatformVersion=$($preferred.Name)"
- name: Build Release DLL targets
shell: pwsh
run: msbuild wintun.proj /m /t:Dll /p:Configuration=Release /p:WindowsTargetPlatformVersion=$env:WINTUN_SDK_VERSION
- name: Stage release assets
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path out | Out-Null
Copy-Item "Release/amd64/wintun.dll" "out/wintun-amd64.dll"
Copy-Item "Release/arm64/wintun.dll" "out/wintun-arm64.dll"
Copy-Item "Release/x86/wintun.dll" "out/wintun-x86.dll"
- name: Generate SHA256SUMS
shell: pwsh
run: |
$items = @("wintun-amd64.dll", "wintun-arm64.dll", "wintun-x86.dll")
Remove-Item -ErrorAction SilentlyContinue out/SHA256SUMS.txt
foreach ($item in $items) {
$hash = (Get-FileHash "out/$item" -Algorithm SHA256).Hash.ToLower()
"$hash $item" | Out-File -FilePath out/SHA256SUMS.txt -Append -Encoding ascii
}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: wintun-artifacts
path: out/*