# GitHub repository information $RepoOwner = "Warky-Devs" $RepoName = "go-mdtopdf-helper" $GitHubApi = "https://api.github.com" # Determine architecture $Arch = if ([Environment]::Is64BitOperatingSystem) { "x86_64" } else { "386" } # Get the latest release information Write-Host "Fetching latest release information..." $LatestRelease = Invoke-RestMethod -Uri "$GitHubApi/repos/$RepoOwner/$RepoName/releases/latest" $Version = $LatestRelease.tag_name $Version = $Version -replace '^v', '' # Remove 'v' prefix if present if (-not $Version) { Write-Host "Failed to get latest version" exit 1 } # Construct the asset name with correct capitalization $AssetName = "$RepoName`_$Version`_Windows_$Arch.zip" # Find the asset URL $Asset = $LatestRelease.assets | Where-Object { $_.name -eq $AssetName } if (-not $Asset) { Write-Host "Failed to find download URL for $AssetName" Write-Host "Looking for asset: $AssetName" exit 1 } # Create bin directory if it doesn't exist New-Item -ItemType Directory -Force -Path "bin" | Out-Null # Download and extract the release Write-Host "Downloading $AssetName..." $ZipPath = "bin\$AssetName" Invoke-WebRequest -Uri $Asset.browser_download_url -OutFile $ZipPath Expand-Archive -Path $ZipPath -DestinationPath "bin" -Force Remove-Item $ZipPath Write-Host "Successfully downloaded and installed go-mdtopdf-helper $Version" Write-Host "Binary location: bin\go-mdtopdf-helper.exe"