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 d8a966c commit 5ea8558
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,55 @@ jobs:
if: matrix.os == 'windows-11-preview_aarch64'
shell: powershell
run: |
$ErrorActionPreference = "Stop"
$ConfirmPreference = 'None'
Install-Script -Name winget-install
winget-install
function Install-Package {
param (
[string]$packageUrl, # URL to download the package from
[string]$packageName # Name of the package (for path management)
)
# Define file paths
$archivePath = "$env:RUNNER_TEMP\$packageName.zip"
$extractPath = "$env:RUNNER_TEMP\$packageName"
$msixPath = "$env:RUNNER_TEMP\Microsoft.DesktopAppInstaller.msixbundle"
# Download the package
Invoke-WebRequest -Uri $packageUrl -OutFile $archivePath -UseBasicParsing
# If it's a .zip file (for .appx), extract it
if ($packageUrl -like "*nuget*") {
New-Item -ItemType Directory -Force -Path $extractPath
Expand-Archive -Path $archivePath -DestinationPath $extractPath
$appxFile = Get-ChildItem -Path "$extractPath\tools\AppX\x64\Release" -Filter "*.appx" | Select-Object -First 1
if ($appxFile) {
Add-AppxPackage -Path $appxFile.FullName
} else {
Write-Error "No .appx file found"
}
# Clean up .zip and extracted folder
Remove-Item -Path $archivePath, $extractPath -Recurse
}
# If it's an MSIX bundle (for .msix), just install it
elseif ($packageUrl -like "*msixbundle*") {
Add-AppxPackage -Path $archivePath
# Clean up MSIX bundle
Remove-Item -Path $archivePath -Force
}
else {
Write-Error "Unsupported file type"
}
}
# Define URLs and paths
$nugetUrl = "https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/"
$msixUrl = "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
# Install the .appx package
Install-Package -packageUrl $nugetUrl -packageName "Microsoft.UI.Xaml"
# Install the MSIX bundle
Install-Package -packageUrl $msixUrl -packageName "Microsoft.DesktopAppInstaller"
# Repair WinGet package manager and install Nushell
Repair-WinGetPackageManager -IncludePrerelease
winget install nushell
- name: Use nushell
Expand Down

0 comments on commit 5ea8558

Please sign in to comment.