-
Notifications
You must be signed in to change notification settings - Fork 112
145 lines (119 loc) · 4.78 KB
/
release.yml
File metadata and controls
145 lines (119 loc) · 4.78 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
env:
SOLUTION_FILE_PATH: Injector.sln
BUILD_CONFIGURATION: Release
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
platform: [Win32, x64, ARM64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install vpatch
shell: pwsh
run: |
dotnet tool install --global Nefarius.Tools.Vpatch
"$env:USERPROFILE\.dotnet\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Stamp version in resource file
shell: pwsh
run: |
$tagVersion = "${{ github.ref_name }}".TrimStart("v")
$versionParts = $tagVersion.Split(".")
if ($versionParts.Count -eq 3) {
$tagVersion = "$tagVersion.0"
}
elseif ($versionParts.Count -ne 4) {
throw "Unsupported tag version format '$tagVersion'. Expected 3 or 4 numeric segments."
}
$versionParts = $tagVersion.Split(".")
foreach ($part in $versionParts) {
if ($part -notmatch '^\d+$') {
throw "Unsupported tag version '$tagVersion'. Each segment in versionParts must be numeric before calling vpatch."
}
}
vpatch --stamp-version "$tagVersion" --target-file "Injector/Injector.rc" --resource.file-version --resource.product-version
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build
run: msbuild /m /p:Configuration="${{ env.BUILD_CONFIGURATION }}" /p:Platform=${{ matrix.platform }} ${{ env.SOLUTION_FILE_PATH }}
- name: Stage binary artifact
shell: pwsh
run: |
$source = Join-Path "${{ github.workspace }}" "bin/${{ matrix.platform }}/Injector.exe"
if (!(Test-Path $source)) {
throw "Expected binary not found: $source"
}
$targetDir = Join-Path "${{ github.workspace }}" "artifacts/${{ matrix.platform }}"
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
Copy-Item -Path $source -Destination (Join-Path $targetDir "Injector.exe") -Force
- name: Upload platform artifact
uses: actions/upload-artifact@v4
with:
name: Injector-${{ matrix.platform }}
path: artifacts/${{ matrix.platform }}/Injector.exe
if-no-files-found: error
retention-days: 1
package-and-release:
runs-on: windows-latest
needs: build
steps:
- name: Download Win32 artifact
uses: actions/download-artifact@v4
with:
name: Injector-Win32
path: downloaded/Win32
- name: Download x64 artifact
uses: actions/download-artifact@v4
with:
name: Injector-x64
path: downloaded/x64
- name: Download ARM64 artifact
uses: actions/download-artifact@v4
with:
name: Injector-ARM64
path: downloaded/ARM64
- name: Assemble zip structure
shell: pwsh
run: |
$releaseRoot = Join-Path "${{ github.workspace }}" "release-content"
$zipPath = Join-Path "${{ github.workspace }}" "Injector_x86_amd64_arm64_unsigned.zip"
if (Test-Path $releaseRoot) {
Remove-Item -Path $releaseRoot -Recurse -Force
}
if (Test-Path $zipPath) {
Remove-Item -Path $zipPath -Force
}
$arm64Dir = Join-Path $releaseRoot "ARM64"
$win32Dir = Join-Path $releaseRoot "Win32"
$x64Dir = Join-Path $releaseRoot "x64"
New-Item -ItemType Directory -Force -Path $arm64Dir, $win32Dir, $x64Dir | Out-Null
Copy-Item -Path "downloaded/ARM64/Injector.exe" -Destination (Join-Path $arm64Dir "Injector.exe") -Force
Copy-Item -Path "downloaded/Win32/Injector.exe" -Destination (Join-Path $win32Dir "Injector.exe") -Force
Copy-Item -Path "downloaded/x64/Injector.exe" -Destination (Join-Path $x64Dir "Injector.exe") -Force
Compress-Archive -Path (Join-Path $releaseRoot "*") -DestinationPath $zipPath
- name: Upload unsigned release bundle artifact
uses: actions/upload-artifact@v4
with:
name: unsigned-release-bundle-${{ github.ref_name }}
path: Injector_x86_amd64_arm64_unsigned.zip
if-no-files-found: error
retention-days: 14
- name: Create draft release awaiting EV signing
uses: softprops/action-gh-release@v2
with:
draft: true
body: |
Release draft created automatically.
Final asset must be EV-signed on the maintainer local machine.
Expected final asset name:
- Injector_x86_amd64_arm64.zip
generate_release_notes: true