Skip to content

Commit

Permalink
chore: use nushell in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
oberrich committed Jan 10, 2025
1 parent d7b6adb commit 815f6ea
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ jobs:
[Parameter(Mandatory=$true)] [string]$Message,
[string]$Level = "INFO"
)
Write-Host "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [$Level] - $Message"
$timestamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
if ($Level -eq "ERROR") {
Write-Error "$timestamp [ERROR] - $Message"
} else {
Write-Host "$timestamp [$Level] - $Message"
}
}
Set-ExecutionPolicy Bypass -Scope Process -Force
Expand All @@ -63,18 +68,18 @@ jobs:
if ($_.Hash) {
$expectedHash = if ($_.Hash -like "*.sha256") {
Invoke-WebRequest -Uri $_.Hash -OutFile (Join-Path ${{github.workspace}} (Split-Path $_.Hash -Leaf))
(Get-Content -Path $hashFile).Trim()
Invoke-WebRequest -Uri $_.Hash -OutFile (Join-Path ${{github.workspace}} (Split-Path $_.Hash -Leaf))
(Get-Content -Path $hashFile).Trim()
} else {
$_.Hash
$_.Hash
}
$downloadedHash = (Get-FileHash -Path $filePath -Algorithm SHA256).Hash
if ($downloadedHash -eq $expectedHash) {
Log "$($_.Name) hash verified successfully."
Log "$($_.Name) hash verified successfully."
} else {
Log "Hash mismatch for $($_.Name). Expected: $expectedHash, Got: $downloadedHash"
return
Log "Hash mismatch for $($_.Name). Expected: $expectedHash, Got: $downloadedHash" -Level "ERROR"
return
}
} else {
Log "No hash specified for $($_.Name). Skipping hash verification."
Expand All @@ -85,7 +90,7 @@ jobs:
& $_.Action > $null 2>&1
Log "$($_.Name) installation completed."
} catch {
Log "Failed to install $($_.Name)."
Log "Failed to install $($_.Name)." -Level "ERROR"
}
}
Expand Down

0 comments on commit 815f6ea

Please sign in to comment.