chore: add windows installer
cd797922
11 file(s) · +153 −0
| 16 | 16 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- bookmarks |
|
| 17 | 17 | ``` |
|
| 18 | 18 | ||
| 19 | + | **PowerShell (Windows):** |
|
| 20 | + | ||
| 21 | + | ```powershell |
|
| 22 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) bookmarks |
|
| 23 | + | ``` |
|
| 24 | + | ||
| 19 | 25 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=bookmarks%2F) and drop the binary somewhere on your `$PATH`. |
|
| 20 | 26 | ||
| 21 | 27 | **From source:** |
| 17 | 17 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- cellar |
|
| 18 | 18 | ``` |
|
| 19 | 19 | ||
| 20 | + | **PowerShell (Windows):** |
|
| 21 | + | ||
| 22 | + | ```powershell |
|
| 23 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) cellar |
|
| 24 | + | ``` |
|
| 25 | + | ||
| 20 | 26 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=cellar%2F) and drop the binary somewhere on your `$PATH`. |
|
| 21 | 27 | ||
| 22 | 28 | **From source:** |
| 17 | 17 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- easel |
|
| 18 | 18 | ``` |
|
| 19 | 19 | ||
| 20 | + | **PowerShell (Windows):** |
|
| 21 | + | ||
| 22 | + | ```powershell |
|
| 23 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) easel |
|
| 24 | + | ``` |
|
| 25 | + | ||
| 20 | 26 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=easel%2F) and drop the binary somewhere on your `$PATH`. |
|
| 21 | 27 | ||
| 22 | 28 | **From source:** |
| 17 | 17 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- feeds |
|
| 18 | 18 | ``` |
|
| 19 | 19 | ||
| 20 | + | **PowerShell (Windows):** |
|
| 21 | + | ||
| 22 | + | ```powershell |
|
| 23 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) feeds |
|
| 24 | + | ``` |
|
| 25 | + | ||
| 20 | 26 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=feeds%2F) and drop the binary somewhere on your `$PATH`. |
|
| 21 | 27 | ||
| 22 | 28 | **From source:** |
| 22 | 22 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- jotts |
|
| 23 | 23 | ``` |
|
| 24 | 24 | ||
| 25 | + | **PowerShell (Windows):** |
|
| 26 | + | ||
| 27 | + | ```powershell |
|
| 28 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) jotts |
|
| 29 | + | ``` |
|
| 30 | + | ||
| 25 | 31 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=jotts%2F) and drop the binary somewhere on your `$PATH`. |
|
| 26 | 32 | ||
| 27 | 33 | **From source:** |
| 16 | 16 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- library |
|
| 17 | 17 | ``` |
|
| 18 | 18 | ||
| 19 | + | **PowerShell (Windows):** |
|
| 20 | + | ||
| 21 | + | ```powershell |
|
| 22 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) library |
|
| 23 | + | ``` |
|
| 24 | + | ||
| 19 | 25 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=library%2F) and drop the binary somewhere on your `$PATH`. |
|
| 20 | 26 | ||
| 21 | 27 | **From source:** |
| 16 | 16 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- og |
|
| 17 | 17 | ``` |
|
| 18 | 18 | ||
| 19 | + | **PowerShell (Windows):** |
|
| 20 | + | ||
| 21 | + | ```powershell |
|
| 22 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) og |
|
| 23 | + | ``` |
|
| 24 | + | ||
| 19 | 25 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=og%2F) and drop the binary somewhere on your `$PATH`. |
|
| 20 | 26 | ||
| 21 | 27 | **From source:** |
| 17 | 17 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- posts |
|
| 18 | 18 | ``` |
|
| 19 | 19 | ||
| 20 | + | **PowerShell (Windows):** |
|
| 21 | + | ||
| 22 | + | ```powershell |
|
| 23 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) posts |
|
| 24 | + | ``` |
|
| 25 | + | ||
| 20 | 26 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=posts%2F) and drop the binary somewhere on your `$PATH`. |
|
| 21 | 27 | ||
| 22 | 28 | **From source:** |
| 17 | 17 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- shrink |
|
| 18 | 18 | ``` |
|
| 19 | 19 | ||
| 20 | + | **PowerShell (Windows):** |
|
| 21 | + | ||
| 22 | + | ```powershell |
|
| 23 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) shrink |
|
| 24 | + | ``` |
|
| 25 | + | ||
| 20 | 26 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=shrink%2F) and drop the binary somewhere on your `$PATH`. |
|
| 21 | 27 | ||
| 22 | 28 | **From source:** |
| 22 | 22 | curl -fsSL https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.sh | sh -s -- sipp |
|
| 23 | 23 | ``` |
|
| 24 | 24 | ||
| 25 | + | **PowerShell (Windows):** |
|
| 26 | + | ||
| 27 | + | ```powershell |
|
| 28 | + | & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) sipp |
|
| 29 | + | ``` |
|
| 30 | + | ||
| 25 | 31 | **Prebuilt binary:** Grab the right archive from the [releases page](https://github.com/stevedylandev/andromeda/releases?q=sipp%2F) and drop the binary somewhere on your `$PATH`. |
|
| 26 | 32 | ||
| 27 | 33 | **From source:** |
| 1 | + | # Andromeda installer (Windows / PowerShell). |
|
| 2 | + | # |
|
| 3 | + | # Usage: |
|
| 4 | + | # irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1 | iex |
|
| 5 | + | # # then: |
|
| 6 | + | # Install-Andromeda sipp |
|
| 7 | + | # Install-Andromeda feeds v0.4.0 |
|
| 8 | + | # |
|
| 9 | + | # Or one-shot: |
|
| 10 | + | # & ([scriptblock]::Create((irm https://raw.githubusercontent.com/stevedylandev/andromeda/main/install.ps1))) sipp |
|
| 11 | + | # |
|
| 12 | + | # Env: |
|
| 13 | + | # $env:INSTALL_DIR target dir (default: $env:LOCALAPPDATA\andromeda) |
|
| 14 | + | ||
| 15 | + | param( |
|
| 16 | + | [Parameter(Position = 0)][string]$App, |
|
| 17 | + | [Parameter(Position = 1)][string]$Version |
|
| 18 | + | ) |
|
| 19 | + | ||
| 20 | + | $ErrorActionPreference = "Stop" |
|
| 21 | + | $Repo = "stevedylandev/andromeda" |
|
| 22 | + | ||
| 23 | + | function Install-Andromeda { |
|
| 24 | + | param( |
|
| 25 | + | [Parameter(Mandatory = $true)][string]$App, |
|
| 26 | + | [string]$Version |
|
| 27 | + | ) |
|
| 28 | + | ||
| 29 | + | # Detect arch |
|
| 30 | + | $archMap = @{ |
|
| 31 | + | "AMD64" = "x86_64" |
|
| 32 | + | "ARM64" = "arm64" |
|
| 33 | + | } |
|
| 34 | + | $procArch = $env:PROCESSOR_ARCHITECTURE |
|
| 35 | + | if (-not $archMap.ContainsKey($procArch)) { |
|
| 36 | + | throw "Unsupported arch: $procArch" |
|
| 37 | + | } |
|
| 38 | + | $arch = $archMap[$procArch] |
|
| 39 | + | if ($arch -eq "arm64") { |
|
| 40 | + | throw "No windows/arm64 build published (goreleaser config ignores it)." |
|
| 41 | + | } |
|
| 42 | + | ||
| 43 | + | # Resolve version |
|
| 44 | + | if (-not $Version) { |
|
| 45 | + | Write-Host "Looking up latest $App release..." |
|
| 46 | + | $releases = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases?per_page=50" |
|
| 47 | + | $match = $releases | Where-Object { $_.tag_name -like "$App/v*" } | Select-Object -First 1 |
|
| 48 | + | if (-not $match) { throw "No releases found for $App" } |
|
| 49 | + | $Version = ($match.tag_name -split "/", 2)[1] |
|
| 50 | + | } |
|
| 51 | + | ||
| 52 | + | $verNum = $Version.TrimStart("v") |
|
| 53 | + | $tag = "$App/$Version" |
|
| 54 | + | $archive = "${App}_${verNum}_windows_${arch}.zip" |
|
| 55 | + | $url = "https://github.com/$Repo/releases/download/$tag/$archive" |
|
| 56 | + | ||
| 57 | + | $installDir = if ($env:INSTALL_DIR) { $env:INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA "andromeda" } |
|
| 58 | + | New-Item -ItemType Directory -Force -Path $installDir | Out-Null |
|
| 59 | + | ||
| 60 | + | $tmp = New-Item -ItemType Directory -Path (Join-Path $env:TEMP ([guid]::NewGuid())) |
|
| 61 | + | try { |
|
| 62 | + | Write-Host "Downloading $url" |
|
| 63 | + | $zipPath = Join-Path $tmp $archive |
|
| 64 | + | Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing |
|
| 65 | + | Expand-Archive -Path $zipPath -DestinationPath $tmp -Force |
|
| 66 | + | ||
| 67 | + | $exeName = "$App.exe" |
|
| 68 | + | $src = Join-Path $tmp $exeName |
|
| 69 | + | if (-not (Test-Path $src)) { |
|
| 70 | + | throw "Binary $exeName not found in archive" |
|
| 71 | + | } |
|
| 72 | + | $dest = Join-Path $installDir $exeName |
|
| 73 | + | Move-Item -Path $src -Destination $dest -Force |
|
| 74 | + | ||
| 75 | + | Write-Host "Installed $App $Version to $dest" |
|
| 76 | + | ||
| 77 | + | # PATH hint |
|
| 78 | + | $userPath = [Environment]::GetEnvironmentVariable("Path", "User") |
|
| 79 | + | if ($userPath -notlike "*$installDir*") { |
|
| 80 | + | Write-Host "" |
|
| 81 | + | Write-Host "Add to PATH (run once):" -ForegroundColor Yellow |
|
| 82 | + | Write-Host " [Environment]::SetEnvironmentVariable('Path', `"`$env:Path;$installDir`", 'User')" |
|
| 83 | + | } |
|
| 84 | + | } |
|
| 85 | + | finally { |
|
| 86 | + | Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue |
|
| 87 | + | } |
|
| 88 | + | } |
|
| 89 | + | ||
| 90 | + | # If invoked with args (one-shot mode via scriptblock), run immediately. |
|
| 91 | + | if ($App) { |
|
| 92 | + | Install-Andromeda -App $App -Version $Version |
|
| 93 | + | } |