Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe51a7b

Browse files
authored
feat: include mutagen binary in installer (#47)
`Publish.ps1` now downloads (if unmodified) the necessary mutagen filesfrom our GCS bucket. These files aren't checked into the repo since theyare large, but they will be cached and ignored in the workdir.`mutagen.exe` and `mutagen-agents.tar.gz` will appear in the samedirectory as `wintun.dll` in the install.```powershellPS C:\Users\dean\git\coder-desktop-windows> ls .\publish\buildtemp-1.2.3.4-x64\vpn Directory: C:\Users\dean\git\coder-desktop-windows\publish\buildtemp-1.2.3.4-x64\vpnMode LastWriteTime Length Name---- ------------- ------ -----a---- 1/03/2025 12:02 5431 LICENSE.WINTUN.txt-a---- 10/03/2025 11:58 17964207 mutagen-agents.tar.gz-a---- 10/03/2025 11:58 13797376 mutagen.exe-a---- 1/03/2025 15:20 427552 wintun.dll```Updating to a new mutagen version is as simple as updating`$mutagenVersion` in `Publish.ps1`.Closes#25
1 parent8e6ec03 commitbe51a7b

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

‎scripts/Publish.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,30 @@ function Add-CoderSignature([string] $path) {
8383
}
8484
}
8585

86+
functionDownload-File([string]$url, [string]$outputPath, [string]$etagFile) {
87+
Write-Host"Downloading '$url' to '$outputPath'"
88+
# We use `curl.exe` here because `Invoke-WebRequest` is notoriously slow.
89+
&curl.exe`
90+
--progress-bar`
91+
--show-error`
92+
--fail`
93+
--location`
94+
--etag-compare$etagFile`
95+
--etag-save$etagFile`
96+
--output$outputPath`
97+
$url
98+
if ($LASTEXITCODE-ne0) {throw"Failed to download$url" }
99+
if (!(Test-Path$outputPath)-or (Get-Item$outputPath).Length-eq0) {
100+
throw"Failed to download '$url', output file '$outputPath' is missing or empty"
101+
}
102+
}
103+
104+
$goArch=switch ($arch) {
105+
"x64" {"amd64" }
106+
"arm64" {"arm64" }
107+
default {throw"Unsupported architecture:$arch" }
108+
}
109+
86110
# CD to the root of the repo
87111
$repoRoot=Resolve-Path (Join-Path$PSScriptRoot"..")
88112
Push-Location$repoRoot
@@ -145,6 +169,24 @@ if ($null -eq $wintunDllSrc) {
145169
$wintunDllDest=Join-Path$vpnFilesPath"wintun.dll"
146170
Copy-Item$wintunDllSrc$wintunDllDest
147171

172+
# Download the mutagen binary from our bucket for this platform if we don't have
173+
# it yet (or it's different).
174+
$mutagenVersion="v0.18.1"
175+
$mutagenSrcPath=Join-Path$repoRoot"scripts\files\mutagen-windows-$($goArch).exe"
176+
$mutagenSrcUrl="https://storage.googleapis.com/coder-desktop/mutagen/$($mutagenVersion)/mutagen-windows-$($goArch).exe"
177+
$mutagenEtagFile=$mutagenSrcPath+".etag"
178+
Download-File$mutagenSrcUrl$mutagenSrcPath$mutagenEtagFile
179+
$mutagenDestPath=Join-Path$vpnFilesPath"mutagen.exe"
180+
Copy-Item$mutagenSrcPath$mutagenDestPath
181+
182+
# Download mutagen agents tarball.
183+
$mutagenAgentsSrcPath=Join-Path$repoRoot"scripts\files\mutagen-agents.tar.gz"
184+
$mutagenAgentsSrcUrl="https://storage.googleapis.com/coder-desktop/mutagen/$($mutagenVersion)/mutagen-agents.tar.gz"
185+
$mutagenAgentsEtagFile=$mutagenAgentsSrcPath+".etag"
186+
Download-File$mutagenAgentsSrcUrl$mutagenAgentsSrcPath$mutagenAgentsEtagFile
187+
$mutagenAgentsDestPath=Join-Path$vpnFilesPath"mutagen-agents.tar.gz"
188+
Copy-Item$mutagenAgentsSrcPath$mutagenAgentsDestPath
189+
148190
# Build the MSI installer
149191
&dotnet.exe run--project .\Installer\Installer.csproj-c Release--`
150192
build-msi`

‎scripts/files/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mutagen-*.tar.gz
2+
mutagen-*.exe
3+
*.etag

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp