Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

release-app retry v2.4.219 windows downloader

Louis Beaumont73a7d1845a71
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 509978d15..f36ae7f73 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -531,37 +531,18 @@ jobs:
$env:Path = "$found;" + $env:Path
ninja --version
- - name: Install wget on Windows
+ - name: Verify Windows download support
if: matrix.os_type == 'windows'
shell: powershell
env:
SKIP_SCREENPIPE_SETUP: true
run: |
- # Remove wget alias if it exists
+ # Avoid PowerShell's wget alias shadowing real download behavior.
if (Test-Path Alias:wget) {
Remove-Item Alias:wget -Force
}
- $wgetDir = "C:\wget"
- # Skip download if already installed (self-hosted runners)
- if (Test-Path "$wgetDir\wget.exe") {
- Write-Host "wget already installed, skipping download"
- } else {
- New-Item -ItemType Directory -Force -Path $wgetDir
-
- $wgetUrl = "https://eternallybored.org/misc/wget/releases/wget-1.21.4-win64.zip"
- $wgetZip = "$wgetDir\wget.zip"
-
- Invoke-WebRequest -Uri $wgetUrl -OutFile $wgetZip
- Expand-Archive -Path $wgetZip -DestinationPath $wgetDir -Force
- Remove-Item $wgetZip
- }
-
- # Add to PATH for current session only
- $env:Path = "$wgetDir;$env:Path"
-
- # Verify installation
- & "$wgetDir\wget.exe" --version
+ curl.exe --version
- name: Run pre_build.js
run: bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
diff --git a/apps/screenpipe-app-tauri/scripts/find_tools.js b/apps/screenpipe-app-tauri/scripts/find_tools.js
index 67deed8ee..7b4bf8b0a 100644
--- a/apps/screenpipe-app-tauri/scripts/find_tools.js
+++ b/apps/screenpipe-app-tauri/scripts/find_tools.js
@@ -6,6 +6,37 @@ import { $ } from 'bun'
import fs from 'fs/promises'
import path from 'path'
+export async function downloadFile(url, destination, { retries = 5 } = {}) {
+ let lastError;
+
+ for (let attempt = 1; attempt <= retries; attempt++) {
+ try {
+ console.log(`downloading ${url} -> ${destination} (${attempt}/${retries})`);
+ const response = await fetch(url, {
+ redirect: 'follow',
+ headers: {
+ 'user-agent': 'screenpipe-build',
+ },
+ });
+
+ if (!response.ok) {
+ throw new Error(`download failed with HTTP ${response.status} ${response.statusText}`);
+ }
+
+ await Bun.write(destination, response);
+ return;
+ } catch (error) {
+ lastError = error;
+ await fs.rm(destination, { force: true }).catch(() => {});
+ if (attempt < retries) {
+ await new Promise((resolve) => setTimeout(resolve, Math.min(30000, 2000 * attempt)));
+ }
+ }
+ }
+
+ throw lastError;
+}
+
export async function findWget() {
const possiblePaths = [
'C:\\ProgramData\\chocolatey\\bin\\wget.exe',
diff --git a/apps/screenpipe-app-tauri/scripts/pre_build.js b/apps/screenpipe-app-tauri/scripts/pre_build.js
index 53b5fc438..f090ed61b 100644
--- a/apps/screenpipe-app-tauri/scripts/pre_build.js
+++ b/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -8,7 +8,7 @@ import fs from 'fs/promises'
import os from 'os'
import path from 'path'
import { setupOpenBlas } from './setup_openblas.js'
-import { findWget, find7z } from './find_tools.js'
+import { downloadFile, find7z } from './find_tools.js'
const originalCWD = process.cwd()
// Change CWD to src-tauri
@@ -452,7 +452,6 @@ async function copyVcredistDlls(arch = 'x64') {
/* ########## Windows ########## */
if (platform == 'windows') {
- const wgetPath = await findWget();
const sevenZ = await find7z();
// Setup FFMPEG (x64: gyan.dev; arm64: tordona/ffmpeg-win-arm64)
@@ -467,7 +466,7 @@ if (platform == 'windows') {
const arm64Url = asset.browser_download_url
const arm64Filename = asset.name
console.log(`ffmpeg ARM64: ${arm64Url}`)
- await $`${wgetPath} --no-config --tries=10 --retry-connrefused --waitretry=10 --secure-protocol=auto --no-check-certificate --show-progress ${arm64Url} -O ${arm64Filename}`
+ await downloadFile(arm64Url, arm64Filename, { retries: 10 })
await $`${sevenZ} x ${arm64Filename}`
// tordona 7z extracts to a single folder; move its contents to ffmpeg (or rename if single top-level dir)
const entries = await fs.readdir(cwd, { withFileTypes: true })
@@ -483,7 +482,7 @@ if (platform == 'windows') {
}
await fs.rm(path.join(cwd, arm64Filename), { force: true }).catch(() => {})
} else {
- await $`${wgetPath} --no-config --tries=10 --retry-connrefused --waitretry=10 --secure-protocol=auto --no-check-certificate --show-progress ${config.windows.ffmpegUrl} -O ${config.windows.ffmpegName}.7z`
+ await downloadFile(config.windows.ffmpegUrl, `${config.windows.ffmpegName}.7z`, { retries: 10 })
await $`${sevenZ} x ${config.windows.ffmpegName}.7z`
await $`mv ${config.windows.ffmpegName} ${config.ffmpegRealname}`
await $`rm -rf ${config.windows.ffmpegName}.7z`
diff --git a/apps/screenpipe-app-tauri/scripts/setup_openblas.js b/apps/screenpipe-app-tauri/scripts/setup_openblas.js
index ed8514d24..89486d582 100644
--- a/apps/screenpipe-app-tauri/scripts/setup_openblas.js
+++ b/apps/screenpipe-app-tauri/scripts/setup_openblas.js
@@ -12,7 +12,7 @@ import { $ } from 'bun'
import fs from 'fs/promises'
import os from 'os'
import path from 'path'
-import { findWget, find7z } from './find_tools.js'
+import { downloadFile, find7z } from './find_tools.js'
const config = {
openblasRealname: 'openblas',
@@ -29,16 +29,15 @@ const config = {
* @returns {Promise<string>} path to openblas directory
*/
export async function setupOpenBlas({ cwd, winArch }) {
- const wgetPath = await findWget()
const sevenZ = await find7z()
if (!(await fs.exists(path.join(cwd, config.openblasRealname)))) {
if (winArch === 'arm64') {
- await $`${wgetPath} --no-config --tries=5 ${config.windows.openblasUrlArm64} -O ${config.windows.openblasNameArm64}.zip`
+ await downloadFile(config.windows.openblasUrlArm64, `${config.windows.openblasNameArm64}.zip`, { retries: 5 })
await $`${sevenZ} x ${config.windows.openblasNameArm64}.zip -o${config.openblasRealname} -y`
await fs.rm(path.join(cwd, `${config.windows.openblasNameArm64}.zip`), { force: true })
} else {
- await $`${wgetPath} --no-config --tries=5 ${config.windows.openblasUrl} -O ${config.windows.openblasName}.zip`
+ await downloadFile(config.windows.openblasUrl, `${config.windows.openblasName}.zip`, { retries: 5 })
await $`${sevenZ} x ${config.windows.openblasName}.zip -o${config.openblasRealname} -y`
await fs.rm(path.join(cwd, `${config.windows.openblasName}.zip`), { force: true })
}