Skip to content

Commit 9d7d52b

Browse files
committed
Windows installer
```pwsh irm https://pkgx.sh | iex ```
1 parent 38ea2b0 commit 9d7d52b

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.github/workflows/cd.installer.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
branches: main
44
paths:
55
- installer.sh
6+
- installer.ps1
67
- .github/workflows/cd.installer.yml
78

89
jobs:
@@ -32,14 +33,15 @@ jobs:
3233

3334
- run:
3435
aws s3 cp
35-
./installer.sh s3://www.pkgx.sh/installer.sh
36+
./installer.sh installer.ps1
37+
s3://www.pkgx.sh/installer.sh
3638
--metadata-directive REPLACE
3739
--cache-control no-cache,must-revalidate
3840

3941
- run:
4042
aws cloudfront create-invalidation
4143
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
42-
--paths / /installer.sh
44+
--paths / /installer.sh /installer.ps1
4345

4446
- name: Seal Deployment
4547
uses: bobheadxi/deployments@v1

installer.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# irm https://pkgx.sh | iex
2+
3+
$ErrorActionPreference = "Stop"
4+
5+
# Determine install location
6+
$installDir = "$env:ProgramFiles\pkgx"
7+
8+
# Create directory if it doesn't exist
9+
if (!(Test-Path $installDir)) {
10+
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
11+
}
12+
13+
# Download and extract
14+
$zipUrl = "https://pkgx.sh/Windows/x86_64.zip"
15+
$zipFile = "$env:TEMP\pkgx.zip"
16+
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile
17+
Expand-Archive -Path $zipFile -DestinationPath $installDir -Force
18+
Remove-Item $zipFile
19+
20+
# Ensure PATH is updated
21+
$envPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
22+
if ($envPath -notlike "*$installDir*") {
23+
[System.Environment]::SetEnvironmentVariable("Path", "$envPath;$installDir", [System.EnvironmentVariableTarget]::Machine)
24+
}
25+
26+
Write-Host "pkgx installed successfully! Restart your terminal to use it."

0 commit comments

Comments
 (0)