From b27746acea0769a4bc1967a8988003425709c854 Mon Sep 17 00:00:00 2001 From: Ayush Date: Mon, 15 Sep 2025 14:15:55 +0530 Subject: [PATCH 1/2] WIP: install script for windows Signed-off-by: Ayush --- .goreleaser.yml | 13 ++++++++++- install.ps1 | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 install.ps1 diff --git a/.goreleaser.yml b/.goreleaser.yml index 0654193..fe51be5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,6 +16,7 @@ builds: goos: - linux - darwin # macOS + - windows goarch: - amd64 # For Intel/AMD processors - arm64 # For Apple Silicon and other ARM processors @@ -29,4 +30,14 @@ archives: # Files to include in the archive along with the binary. files: - LICENSE - - README.md \ No newline at end of file + - README.md + + - format: zip + # <-- Add this block for Windows + name_template: >- + {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} + files: + - LICENSE + - README.md + replacements: + windows: windows \ No newline at end of file diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..20c6d6c --- /dev/null +++ b/install.ps1 @@ -0,0 +1,59 @@ +# GitX Windows Installer Script +# Usage: Invoke-WebRequest -Uri "https://raw.githubusercontent.com/gitxtui/gitx/master/install.ps1" -OutFile "install.ps1"; .\install.ps1 + +$repo = "gitxtui/gitx" +$installDir = "$env:ProgramFiles\gitx" + +function Get-Arch { + switch ($env:PROCESSOR_ARCHITECTURE) { + "AMD64" { return "amd64" } + "ARM64" { return "arm64" } + default { Write-Error "Unsupported architecture: $($env:PROCESSOR_ARCHITECTURE)"; exit 1 } + } +} + +function Get-LatestRelease { + $apiUrl = "https://api.github.com/repos/$repo/releases" + $response = Invoke-RestMethod -Uri $apiUrl + if ($response -is [System.Collections.IEnumerable] -and $response.Count -gt 0) { + return $response[0].tag_name + } else { + Write-Error "Could not find any release version for $repo." + exit 1 + } +} + +function Main { + $os = "windows" + $arch = Get-Arch + $version = Get-LatestRelease + $versionNum = $version -replace "^v", "" + $filename = "gitx_${versionNum}_${os}_${arch}.zip" + $downloadUrl = "https://github.com/$repo/releases/download/$version/$filename" + + Write-Host "Downloading gitx $version for $os/$arch..." + $tempDir = New-TemporaryFile | Split-Path + $zipPath = Join-Path $tempDir $filename + Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath + + Write-Host "Extracting..." + Expand-Archive -Path $zipPath -DestinationPath $tempDir + + if (!(Test-Path $installDir)) { + New-Item -ItemType Directory -Path $installDir | Out-Null + } + + $gitxExe = Get-ChildItem -Path $tempDir -Filter "gitx.exe" -Recurse | Select-Object -First 1 + if ($null -eq $gitxExe) { + Write-Error "gitx.exe not found in the archive." + exit 1 + } + + Copy-Item -Path $gitxExe.FullName -Destination (Join-Path $installDir "gitx.exe") -Force + + Write-Host "`ngitx has been installed to $installDir" + Write-Host "Add $installDir to your PATH if not already present." + Write-Host "Run 'gitx.exe' to get started." +} + +Main \ No newline at end of file From 3dda03d5dfa635e35c9d246a5e6acbb514db49e2 Mon Sep 17 00:00:00 2001 From: Jatin Date: Mon, 15 Sep 2025 14:18:15 +0530 Subject: [PATCH 2/2] WIP Signed-off-by: Jatin --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index fe51be5..290d214 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -32,8 +32,8 @@ archives: - LICENSE - README.md + # zip format to support installation for windows - format: zip - # <-- Add this block for Windows name_template: >- {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} files: