Skip to content

Commit

Permalink
chore: use powershell in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
oberrich committed Jan 10, 2025
1 parent bd1f5a7 commit b01b521
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,35 @@ jobs:
Log "Downloading $($_.Name) from $($_.Url)..."
$install_file = Join-Path ${{github.workspace}} (Split-Path $_.Url -Leaf)
Invoke-WebRequest -Uri $_.Url -OutFile $install_file
}
# Handle hash verification if provided
if ($_.Hash -ne $null) {
$expected_hash = if ($_.Hash -like "*.sha256") {
$hash_file = Join-Path ${{github.workspace}} (Split-Path $_.Hash -Leaf)
Invoke-WebRequest -Uri $_.Hash -OutFile $hash_file
(Get-Content -Path $hash_file).Trim()
} else {
$_.Hash
}
if ($_.Hash -ne $null) {
$expected_hash = if ($_.Hash -like "*.sha256") {
$hash_file = Join-Path ${{github.workspace}} (Split-Path $_.Hash -Leaf)
Invoke-WebRequest -Uri $_.Hash -OutFile $hash_file
(Get-Content -Path $hash_file).Trim()
} else {
$_.Hash
}
$downloaded_hash = (Get-FileHash -Path $install_file -Algorithm SHA256).Hash
if ($downloadedHash -eq $expected_hash) {
Log "$($_.Name) hash verified successfully."
} else {
Log "Hash mismatch for $($_.Name). Expected: $expected_hash, Got: $downloaded_hash" -Level "ERROR"
exit 1
}
$downloaded_hash = (Get-FileHash -Path $install_file -Algorithm SHA256).Hash
if ($downloaded_hash -eq $expected_hash) {
Log "$($_.Name) hash verified successfully."
} else {
Log "No hash specified for $($_.Name). Skipping hash verification."
Log "Hash mismatch for $($_.Name). Expected: $expected_hash, Got: $downloaded_hash" -Level "ERROR"
exit 1
}
} else {
Log "No hash specified for $($_.Name). Skipping hash verification."
}
Log "Starting installation of $($_.Name)..."
try {
& $_.Action > $null 2>&1
Log "$($_.Name) installation completed."
} catch {
Log "Failed to install $($_.Name)." -Level "ERROR"
Log "Failed to install $($_.Name)." -Level "ERROR"
}
}
Expand Down

0 comments on commit b01b521

Please sign in to comment.