Files
nyaterm/scripts/ci/install-nsis.ps1
T
Kang 2df15871cc ci(workflows): update CI configurations and enhance documentation
- Modified `.gitattributes` to ensure nested CI scripts under `scripts/ci/` are correctly matched.
- Updated `CONTRIBUTING.md` for clarity and added details on local checks, including the importance of `--no-fail-fast` in testing.
- Introduced new GitHub Actions for setting up Rust and managing documentation workflows, improving CI efficiency.
- Removed the outdated `native-checks.yml` workflow and replaced it with a more comprehensive `rust.yml` workflow for better testing coverage.
- Added scripts for verifying release assets and installing necessary tooling, enhancing the release process.

This commit refines the CI/CD pipeline, ensuring better organization, clarity, and functionality across workflows and documentation.
2026-08-25 22:53:23 +08:00

37 lines
1.3 KiB
PowerShell

# Installs a checksum-verified portable NSIS and puts makensis.exe on PATH.
#
# Version and digest are pinned together; bump both or the download is rejected.
$ErrorActionPreference = 'Stop'
$version = if ($env:NSIS_VERSION) { $env:NSIS_VERSION } else { '3.12' }
$expectedHash = if ($env:NSIS_ARCHIVE_SHA256) {
$env:NSIS_ARCHIVE_SHA256
} else {
'56581f90db321581c5381193d796fffcf2d24b2f8fed2160a6c6a3baa67f2c4f'
}
Write-Output "::group::Install NSIS $version"
$archiveName = "nsis-$version.zip"
$archivePath = Join-Path $env:RUNNER_TEMP $archiveName
$downloadUrl = "https://downloads.sourceforge.net/project/nsis/NSIS%203/$version/$archiveName"
curl.exe --fail --location --retry 3 --retry-all-errors --output $archivePath $downloadUrl
$actualHash = (Get-FileHash -Algorithm SHA256 $archivePath).Hash.ToLowerInvariant()
if ($actualHash -ne $expectedHash.ToLowerInvariant()) {
throw "NSIS archive checksum mismatch: $actualHash"
}
$extractRoot = Join-Path $env:RUNNER_TEMP "nsis-$version-portable"
Expand-Archive -Path $archivePath -DestinationPath $extractRoot -Force
$nsisBin = Join-Path $extractRoot "nsis-$version"
if (-not (Test-Path (Join-Path $nsisBin 'makensis.exe'))) {
throw 'makensis.exe is missing from the verified NSIS archive'
}
$nsisBin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Output '::endgroup::'