-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpackage-release.ps1
More file actions
205 lines (162 loc) · 5.72 KB
/
package-release.ps1
File metadata and controls
205 lines (162 loc) · 5.72 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
param(
[Parameter(Mandatory = $true)]
[string]$Version,
[Parameter(Mandatory = $false)]
[string]$BuildRoot = "build",
[Parameter(Mandatory = $false)]
[string]$BuildDir = "build/Release",
[Parameter(Mandatory = $false)]
[string]$RenderDocBuildDir = "renderdoc-src/x64/Development",
[Parameter(Mandatory = $false)]
[string]$RenderDocRoot = "renderdoc-src",
[Parameter(Mandatory = $false)]
[string]$RenderDocVersion = "",
[Parameter(Mandatory = $false)]
[string]$OutputRoot = "dist"
)
$ErrorActionPreference = "Stop"
if(-not $Version.StartsWith("v"))
{
throw "Version must start with 'v'."
}
$packageName = "renderdoc-mcp-windows-x64-$Version"
$packageDir = Join-Path $OutputRoot $packageName
$archivePath = Join-Path $OutputRoot "$packageName.zip"
$hashPath = Join-Path $OutputRoot "$packageName.sha256"
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
function Get-ConfiguredRenderDocVersion
{
param(
[Parameter(Mandatory = $false)]
[string]$VersionOverride
)
if($VersionOverride)
{
return $VersionOverride.Trim()
}
$versionFile = Join-Path $repoRoot "renderdoc-version.txt"
if(-not (Test-Path $versionFile))
{
throw "RenderDoc version file not found: $versionFile"
}
return (Get-Content -LiteralPath $versionFile -Raw).Trim()
}
function Copy-RequiredFile
{
param(
[Parameter(Mandatory = $true)]
[string]$Source,
[Parameter(Mandatory = $true)]
[string]$Target
)
if(-not (Test-Path $Source))
{
throw "Required file not found: $Source"
}
$targetDir = Split-Path -Parent $Target
if($targetDir)
{
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
}
Copy-Item -Force $Source $Target
}
if(-not (Test-Path $RenderDocRoot))
{
throw "RenderDoc root not found: $RenderDocRoot"
}
if(-not (Test-Path $BuildRoot))
{
throw "Build root not found: $BuildRoot"
}
$RenderDocVersion = Get-ConfiguredRenderDocVersion -VersionOverride $RenderDocVersion
New-Item -ItemType Directory -Path $OutputRoot -Force | Out-Null
if(Test-Path $packageDir)
{
Remove-Item -Recurse -Force $packageDir
}
if(Test-Path $archivePath)
{
Remove-Item -Force $archivePath
}
if(Test-Path $hashPath)
{
Remove-Item -Force $hashPath
}
New-Item -ItemType Directory -Path $packageDir -Force | Out-Null
$requiredBuildOutputs = @(
(Join-Path $BuildDir "renderdoc-mcp.exe"),
(Join-Path $BuildDir "renderdoc-cli.exe")
)
foreach($path in $requiredBuildOutputs)
{
if(-not (Test-Path $path))
{
throw "Required build output not found: $path"
}
}
$installArgs = @(
"--install", $BuildRoot,
"--config", "Release",
"--prefix", $packageDir
)
& cmake @installArgs
if($LASTEXITCODE -ne 0)
{
throw "cmake --install failed with exit code $LASTEXITCODE"
}
$filesToCopy = @(
@{ Source = (Join-Path $RenderDocBuildDir "d3dcompiler_47.dll"); Target = (Join-Path $packageDir "bin\d3dcompiler_47.dll") },
@{ Source = (Join-Path $RenderDocBuildDir "dbghelp.dll"); Target = (Join-Path $packageDir "bin\dbghelp.dll") },
@{ Source = (Join-Path $RenderDocBuildDir "symsrv.dll"); Target = (Join-Path $packageDir "bin\symsrv.dll") },
@{ Source = (Join-Path $RenderDocBuildDir "symsrv.yes"); Target = (Join-Path $packageDir "bin\symsrv.yes") },
@{ Source = "README.md"; Target = (Join-Path $packageDir "README.md") },
@{ Source = "README-CN.md"; Target = (Join-Path $packageDir "README-CN.md") },
@{ Source = "LICENSE"; Target = (Join-Path $packageDir "LICENSE") },
@{ Source = "install-codex.ps1"; Target = (Join-Path $packageDir "install-codex.ps1") },
@{ Source = (Join-Path $RenderDocRoot "LICENSE.md"); Target = (Join-Path $packageDir "RENDERDOC-LICENSE.md") }
)
foreach($file in $filesToCopy)
{
Copy-RequiredFile -Source $file.Source -Target $file.Target
}
$noticePath = Join-Path $packageDir "THIRD-PARTY-NOTICES.txt"
@"
This package includes renderdoc-mcp, renderdoc-cli, the renderdoc-mcp Codex skill,
and selected runtime files from RenderDoc $RenderDocVersion.
Bundled RenderDoc runtime files:
- bin/renderdoc.dll
- bin/renderdoc.json
- bin/d3dcompiler_47.dll
- bin/dbghelp.dll
- bin/symsrv.dll
- bin/symsrv.yes
Bundled Codex assets:
- skills/renderdoc-mcp
- install-codex.ps1
Bundled executables:
- bin/renderdoc-mcp.exe
- bin/renderdoc-cli.exe
See LICENSE and RENDERDOC-LICENSE.md for licensing details and acknowledgements.
"@ | Set-Content -Path $noticePath -Encoding ascii
$validateScript = Join-Path $PSScriptRoot "validate-release-package.ps1"
& $validateScript -PackageDir $packageDir -ExpectedRenderDocVersion $RenderDocVersion
if($LASTEXITCODE -ne 0)
{
throw "Release package validation failed with exit code $LASTEXITCODE"
}
Compress-Archive -Path $packageDir -DestinationPath $archivePath -CompressionLevel Optimal
$hash = (Get-FileHash $archivePath -Algorithm SHA256).Hash.ToLowerInvariant()
"{0} *{1}" -f $hash, ([IO.Path]::GetFileName($archivePath)) | Set-Content -Path $hashPath -Encoding ascii
$resolvedPackageDir = (Resolve-Path $packageDir).Path
$resolvedArchive = (Resolve-Path $archivePath).Path
$resolvedHash = (Resolve-Path $hashPath).Path
Write-Host "Created package directory: $resolvedPackageDir"
Write-Host "Created archive: $resolvedArchive"
Write-Host "Created SHA256 file: $resolvedHash"
if($env:GITHUB_OUTPUT)
{
"package_dir=$resolvedPackageDir" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
"archive_path=$resolvedArchive" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
"hash_path=$resolvedHash" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
"package_name=$packageName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}