Repository navigation
83 lines (72 loc) · 2.32 KB
/
Copy pathbuild.yml
File metadata and controls
83 lines (72 loc) · 2.32 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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: windows-2022
env:
CONFIGURATION: Release
PLATFORM: Any CPU
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build solution (net35 + net48)
shell: pwsh
run: |
$targets = @(
@{ Framework = 'v3.5'; Out = 'net35' },
@{ Framework = 'v4.8'; Out = 'net48' }
)
foreach ($t in $targets) {
Write-Host "::group::Build $($t.Framework)"
msbuild SharpDPAPI.sln `
/restore `
/t:Rebuild `
/m `
/p:Configuration="$env:CONFIGURATION" `
/p:Platform="$env:PLATFORM" `
/p:TargetFrameworkVersion="$($t.Framework)" `
/p:OutputPath="bin\$($t.Out)\"
if ($LASTEXITCODE -ne 0) { throw "Build failed for $($t.Framework)" }
Write-Host "::endgroup::"
}
- name: Stage artifacts
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist | Out-Null
foreach ($out in 'net35', 'net48') {
foreach ($name in 'SharpDPAPI', 'SharpChrome') {
$exe = "$name\bin\$out\$name.exe"
if (-not (Test-Path $exe)) {
throw "Expected build output was not found: $exe"
}
Get-Item $exe | Format-List FullName, Length, LastWriteTime
Copy-Item $exe "dist\${name}_$out.exe"
}
}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: SharpDPAPI-${{ env.CONFIGURATION }}
path: dist/*.exe
if-no-files-found: error
- name: Compute short SHA
if: github.ref == 'refs/heads/master'
id: sha
run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Publish release
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v2
with:
tag_name: SharpDPAPI-${{ steps.sha.outputs.short }}
name: SharpDPAPI-${{ steps.sha.outputs.short }}
files: dist/*.exe