-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (75 loc) · 2.69 KB
/
release.yml
File metadata and controls
91 lines (75 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build-release:
runs-on: windows-latest
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Restore
run: nuget restore .\IOBusMonitor.sln
- name: Build Release x64
run: msbuild .\IOBusMonitor.sln /p:Configuration=Release /p:Platform="x64"
- name: Run tests
shell: powershell
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhere) {
$vsRoot = & $vswhere -latest -products * -property installationPath
}
$searchRoots = @()
if ($vsRoot) { $searchRoots += (Join-Path $vsRoot "Common7\IDE") }
$searchRoots += @(
"${env:ProgramFiles}\Microsoft Visual Studio",
"${env:ProgramFiles(x86)}\Microsoft Visual Studio"
) | Where-Object { Test-Path $_ }
$vstest = $null
foreach ($root in $searchRoots) {
$candidate = Get-ChildItem $root -Recurse -Filter vstest.console.exe -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($candidate) {
$vstest = $candidate.FullName
break
}
}
if (-not $vstest) { throw "vstest.console.exe not found" }
$testDllCandidates = @(
".\IOBusMonitorLib.Tests\bin\Release\IOBusMonitorLib.Tests.dll",
".\IOBusMonitorLib.Tests\bin\Release\net472\IOBusMonitorLib.Tests.dll",
".\IOBusMonitorLib.Tests\bin\Debug\IOBusMonitorLib.Tests.dll",
".\IOBusMonitorLib.Tests\bin\Debug\net472\IOBusMonitorLib.Tests.dll"
)
$testDll = $testDllCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $testDll) {
throw "IOBusMonitorLib.Tests.dll not found in any expected output folder."
}
& $vstest $testDll
- name: Package release
shell: powershell
run: |
& .\build\package-release.ps1 -GenerateChecksum
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
dist/*.zip
dist/*.zip.sha256