Skip to content

Commit 1bb19aa

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

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

.github/workflows/cd.installer.yml

Lines changed: 10 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,21 @@ jobs:
3233

3334
- run:
3435
aws s3 cp
35-
./installer.sh s3://www.pkgx.sh/installer.sh
36+
./installer.sh
37+
s3://www.pkgx.sh/installer.sh
38+
--metadata-directive REPLACE
39+
--cache-control no-cache,must-revalidate
40+
- run:
41+
aws s3 cp
42+
./installer.ps1
43+
s3://www.pkgx.sh/installer.sh
3644
--metadata-directive REPLACE
3745
--cache-control no-cache,must-revalidate
3846

3947
- run:
4048
aws cloudfront create-invalidation
4149
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
42-
--paths / /installer.sh
50+
--paths / /installer.sh /installer.ps1
4351

4452
- name: Seal Deployment
4553
uses: bobheadxi/deployments@v1

.github/workflows/ci.installer.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
shellcheck:
3030
runs-on: ubuntu-latest
3131
steps:
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@v4
3333
- uses: reviewdog/action-shellcheck@v1
3434

3535
usage-as-proxy:
@@ -182,6 +182,15 @@ jobs:
182182

183183
- run: pkgx deno eval 'console.log(1)'
184184

185+
windows:
186+
runs-on: windows-latest
187+
steps:
188+
- uses: actions/checkout@v4
189+
- run: .\\installer.ps1
190+
- run: |
191+
$env:Path += ";C:\Program Files\pkgx"
192+
pkgx +zlib.net
193+
185194
upgrades:
186195
runs-on: ubuntu-latest
187196
steps:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ $ curl https://pkgx.sh | sh
6262
# - if both are already installed, does an update check
6363
```
6464

65+
```ps1
66+
$ irm https://pkgx.sh | iex
67+
# - installs `pkgx.exe` to `$env:ProgramFiles/pkgx`
68+
# - adds it to your system PATH
69+
```
70+
6571
## Temporary Sandboxes
6672

6773
To use `pkgx` to run a command in a temporary sandbox:

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)