From f60a7cbaea227ab202fc7d6329ba63751479e2bf Mon Sep 17 00:00:00 2001 From: noah Date: Thu, 16 Apr 2026 11:08:31 +0200 Subject: [PATCH] fix: add Windows installer and upload Windows CLI binaries to release - Add install.ps1 PowerShell script for native Windows installation - Update install.sh to redirect Windows users (MINGW/MSYS/CYGWIN) to install.ps1 - Ignore CLI build artifacts (*.exe, *.zip, *.tar.gz) in .gitignore - Windows binaries (x86_64 + arm64) uploaded to v0.1.6 release Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 3 ++ install.ps1 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 10 +++++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 install.ps1 diff --git a/.gitignore b/.gitignore index 425efce..32bda0e 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ next-env.d.ts # CLI build artifacts cli/transmute cli/*.pdf +cli/*.exe +cli/*.zip +cli/*.tar.gz diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..9a41ace --- /dev/null +++ b/install.ps1 @@ -0,0 +1,99 @@ +# Transmute CLI installer for Windows +# Usage: irm https://raw.githubusercontent.com/noauf/Transmute/main/install.ps1 | iex + +$ErrorActionPreference = "Stop" + +$REPO = "noauf/Transmute" +$BINARY = "transmute" + +Write-Host "" +Write-Host " Transmute CLI installer" +Write-Host " ======================" +Write-Host "" + +# Detect architecture +$ARCH = if ([System.Environment]::Is64BitOperatingSystem) { + if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "x86_64" } +} else { + Write-Host " Error: 32-bit Windows is not supported" -ForegroundColor Red + exit 1 +} + +Write-Host " OS: windows" +Write-Host " Arch: $ARCH" +Write-Host "" + +$ASSET = "$BINARY-windows-$ARCH.zip" + +# Get latest release tag +Write-Host " Fetching latest release..." +try { + $release = Invoke-RestMethod -Uri "https://api.github.com/repos/$REPO/releases/latest" -Headers @{ "User-Agent" = "transmute-installer" } + $TAG = $release.tag_name +} catch { + Write-Host " Error: could not fetch latest release: $_" -ForegroundColor Red + exit 1 +} + +if (-not $TAG) { + Write-Host " Error: could not determine latest release" -ForegroundColor Red + exit 1 +} + +Write-Host " Latest version: $TAG" + +$DOWNLOAD_URL = "https://github.com/$REPO/releases/download/$TAG/$ASSET" + +# Create temp directory +$TMP_DIR = Join-Path $env:TEMP "transmute-install-$(Get-Random)" +New-Item -ItemType Directory -Path $TMP_DIR | Out-Null + +try { + $ZIP_PATH = Join-Path $TMP_DIR $ASSET + + Write-Host " Downloading $ASSET..." + Invoke-WebRequest -Uri $DOWNLOAD_URL -OutFile $ZIP_PATH -UseBasicParsing + + Write-Host " Extracting..." + Expand-Archive -Path $ZIP_PATH -DestinationPath $TMP_DIR -Force + + $EXE_NAME = "$BINARY.exe" + $EXE_SOURCE = Join-Path $TMP_DIR "$BINARY-windows-$ARCH.exe" + if (-not (Test-Path $EXE_SOURCE)) { + $EXE_SOURCE = Join-Path $TMP_DIR $EXE_NAME + } + + if (-not (Test-Path $EXE_SOURCE)) { + Write-Host " Error: could not find $EXE_NAME in archive" -ForegroundColor Red + exit 1 + } + + # Determine install directory + $INSTALL_DIR = "$env:LOCALAPPDATA\transmute\bin" + New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null + + $INSTALL_PATH = Join-Path $INSTALL_DIR $EXE_NAME + Copy-Item -Path $EXE_SOURCE -Destination $INSTALL_PATH -Force + + Write-Host "" + Write-Host " Installed transmute $TAG to $INSTALL_PATH" + Write-Host "" + + # Add to PATH if not already there + $USER_PATH = [System.Environment]::GetEnvironmentVariable("PATH", "User") + if ($USER_PATH -notlike "*$INSTALL_DIR*") { + [System.Environment]::SetEnvironmentVariable("PATH", "$USER_PATH;$INSTALL_DIR", "User") + Write-Host " Added $INSTALL_DIR to your PATH." + Write-Host " Restart your terminal for the PATH change to take effect." + Write-Host "" + } + + Write-Host " Get started:" + Write-Host " transmute *.png Convert all PNGs" + Write-Host " transmute ./photos/ Convert all files in a directory" + Write-Host " transmute --help Show all options" + Write-Host "" + +} finally { + Remove-Item -Recurse -Force $TMP_DIR -ErrorAction SilentlyContinue +} diff --git a/install.sh b/install.sh index aa8ad34..c8f9b94 100755 --- a/install.sh +++ b/install.sh @@ -11,7 +11,15 @@ OS="$(uname -s)" case "$OS" in Darwin) OS="darwin" ;; Linux) OS="linux" ;; - MINGW*|MSYS*|CYGWIN*) OS="windows" ;; + MINGW*|MSYS*|CYGWIN*) + echo "" + echo " Windows detected." + echo " Please use the PowerShell installer instead:" + echo "" + echo " irm https://raw.githubusercontent.com/noauf/Transmute/main/install.ps1 | iex" + echo "" + exit 0 + ;; *) echo "Error: unsupported operating system: $OS" exit 1