mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-29 01:11:30 -06:00
3903eaaa24
* Replace Tabs with Spaces to follow the conventions
* Add Preprocessing in Compiler
* Compile from Anywhere you want - Running 'Compile.ps1' Works in any directory you call it from
* Code Formatting Changes
* Result of Preprocessing Step in 'Compile.ps1' Script - Remove Trailing Whitespace Characters
* Make Preprocessing more advanced
* Move Preprocessing to a separate script file
* Make Self Modification impossible for 'tools/Do-PreProcessing.ps1' Script - Make the workingdir same as sync.PSScriptRoot for consistency
* Revert commit b5dffd671f
* Patched a Bug of some Excluded Files not actually get excluded in 'Get-ChildItem' PS Cmdlet
* Update Replace Regex for Code Formatting in 'Do-PreProcessing' Script Tool
* Rename 'Do-PreProcessing' to 'Invoke-Preprocessing' - Update some Comments
* Make 'Invoke-Preprocessing' Modular - Update RegEx to handle more cases - Update Documentation - Add Validations & Useful feedback upon error
* Replace Tabs with Spaces to follow the conventions - 'applications.json' File
* Code Formatting Changes - 'Copy-Files' Private Function
* Update Replace Regex for Code Formatting in 'Invoke-Preprocessing' Script Tool
* Replace Tabs with Spaces to follow the conventions - Make 'ExcludedFiles' validation step check all filepaths before finally checking if any has failed
* Result of 'Invoke-Preprocessing' Script
* Update Replace Regex for Code Formatting in 'Invoke-Preprocessing' Script Tool
27 lines
1.7 KiB
PowerShell
27 lines
1.7 KiB
PowerShell
function Get-WinUtilWingetLatest {
|
|
<#
|
|
.SYNOPSIS
|
|
Uses GitHub API to check for the latest release of Winget.
|
|
.DESCRIPTION
|
|
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
|
#>
|
|
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
|
$PreviousProgressPreference = $ProgressPreference
|
|
$ProgressPreference = "silentlyContinue"
|
|
try {
|
|
# Grabs the latest release of Winget from the Github API for the install process.
|
|
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
|
$latestVersion = $response.tag_name #Stores version number of latest release.
|
|
$licenseWingetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*License1.xml"} #Index value for License file.
|
|
Write-Host "Latest Version:`t$($latestVersion)`n"
|
|
Write-Host "Downloading..."
|
|
$assetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"}
|
|
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
|
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
|
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
|
} catch {
|
|
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
|
}
|
|
$ProgressPreference = $PreviousProgressPreference
|
|
}
|