Skip to content

Commit

Permalink
chore(scripts): fix installer for powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
ekristen committed Nov 25, 2024
1 parent d692c58 commit 6c9c80a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/installers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: installers

on:
workflow_dispatch:
release:
types: [published]

Expand Down
12 changes: 6 additions & 6 deletions scripts/installer.tpl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ $trap = {
$OS = "windows" # Hardcoded for Windows
$ARCH = if ([System.Environment]::Is64BitProcess) { "amd64" } else { "arm64" }

$TAR_FILE = "${FILE_BASENAME}-${VERSION}-${OS}-${ARCH}.tar.gz"
$ZIP_FILE = "${FILE_BASENAME}-${VERSION}-${OS}-${ARCH}.zip"

# Download distillery
Write-Host "Downloading distillery $VERSION..."
Invoke-WebRequest -Uri "$RELEASES_URL/download/$VERSION/$TAR_FILE" -OutFile "$TMP_DIR\$TAR_FILE"
Invoke-WebRequest -Uri "$RELEASES_URL/download/$VERSION/$ZIP_FILE" -OutFile "$TMP_DIR\$ZIP_FILE"
Invoke-WebRequest -Uri "$RELEASES_URL/download/$VERSION/checksums.txt" -OutFile "$TMP_DIR\checksums.txt"

# Verify checksums
Write-Host "Verifying checksums..."
$checksums = Get-Content "$TMP_DIR\checksums.txt" | Where-Object { $_ -match $TAR_FILE }
$checksums = Get-Content "$TMP_DIR\checksums.txt" | Where-Object { $_ -match $ZIP_FILE }
if (-not $checksums) {
Write-Error "Checksum not found for $TAR_FILE"
Write-Error "Checksum not found for $ZIP_FILE"
exit 1
}
$expected = $checksums.Split(" ")[0]
$actual = (Get-FileHash -Path "$TMP_DIR\$TAR_FILE" -Algorithm SHA256).Hash
$actual = (Get-FileHash -Path "$TMP_DIR\$ZIP_FILE" -Algorithm SHA256).Hash
if ($expected -ne $actual) {
Write-Error "Checksum verification failed!"
exit 1
Expand All @@ -65,7 +65,7 @@ if (Get-Command cosign -ErrorAction SilentlyContinue) {

# Extract tar file
Write-Host "Extracting distillery..."
Expand-Archive -Path "$TMP_DIR\$TAR_FILE" -DestinationPath $TMP_DIR -Force
Expand-Archive -Path "$TMP_DIR\$ZIP_FILE" -DestinationPath $TMP_DIR -Force

# Run the installation command
Write-Host "Installing distillery..."
Expand Down

0 comments on commit 6c9c80a

Please sign in to comment.