actions / runner-images

GitHub Actions runner images
MIT License
10.05k stars 3.03k forks source link

Add winget-cli ("App Installer") #910

Closed MCOfficer closed 2 years ago

MCOfficer commented 4 years ago

Tool information

Area for Triage: Scripting and command line (i hope? really unsure where to fit a package manager.)

Question, Bug, or Feature?: Feature

Virtual environments affected

Can this tool be installed during the build? I have not looked into it, since winget-cli is still in preview state. I do not expect you to add it anytime soon, consider this a request for the eventual v1.0. (Feel free to prove me wrong, though :wink: )

maxim-lobanov commented 4 years ago

Thank you for feature request. In general, tool looks good to us but we would like to wait for stable release (v1.0 is going to come on May 2021 based on Roadmap or may be a bit earlier) and install it. Currently, packages base is pretty small and installation looks complicated (build from source code or Microsoft Store). cc: @alepauly

MCOfficer commented 4 years ago

Is there a reason this can't just stay open until winget comes out of preview? just curious

maxim-lobanov commented 4 years ago

@MCOfficer , we would like to keep opened only those issues that we are planning to work on in next weeks / months to simplify maintenance of this repository. Official release date of this tool is defined as May 2021 based on Roadmap. If you see that it is ready for pre-installation before, feel free to ping us and reopen this issue

MCOfficer commented 4 years ago

I will try to keep track of it, if i miss it hopefully someone else picks it up. cheers!

okofish commented 3 years ago

Version 1.0 of Windows Package Manager/winget was just released: https://github.com/microsoft/winget-cli/releases/tag/v1.0.11451

Is it appropriate to reopen this issue now?

miketimofeev commented 3 years ago

@okofish @MCOfficer reopened! Such a long wait 😅

al-cheb commented 3 years ago

We should wait until https://github.com/microsoft/winget-cli/issues/754 will be fixed.

al-cheb commented 3 years ago

Workaround how to install winget in runtime on Windows Server 2019:

jobs:
  build:
    name: Build
    runs-on: windows-latest
    steps:
      - name: winget
        shell: powershell
        run: |
          # Install NtObjectManager module
          Install-Module NtObjectManager -Force
          # Install winget
          $vclibs = Invoke-WebRequest -Uri "https://store.rg-adguard.net/api/GetFiles" -Method "POST" -ContentType "application/x-www-form-urlencoded" -Body "type=PackageFamilyName&url=Microsoft.VCLibs.140.00_8wekyb3d8bbwe&ring=RP&lang=en-US" -UseBasicParsing | Foreach-Object Links | Where-Object outerHTML -match "Microsoft.VCLibs.140.00_.+_x64__8wekyb3d8bbwe.appx" | Foreach-Object href
          $vclibsuwp = Invoke-WebRequest -Uri "https://store.rg-adguard.net/api/GetFiles" -Method "POST" -ContentType "application/x-www-form-urlencoded" -Body "type=PackageFamilyName&url=Microsoft.VCLibs.140.00.UWPDesktop_8wekyb3d8bbwe&ring=RP&lang=en-US" -UseBasicParsing | Foreach-Object Links | Where-Object outerHTML -match "Microsoft.VCLibs.140.00.UWPDesktop_.+_x64__8wekyb3d8bbwe.appx" | Foreach-Object href
          Invoke-WebRequest $vclibsuwp -OutFile Microsoft.VCLibs.140.00.UWPDesktop_8wekyb3d8bbwe.appx
          Invoke-WebRequest $vclibs -OutFile Microsoft.VCLibs.140.00_8wekyb3d8bbwe.appx
          Add-AppxPackage -Path .\Microsoft.VCLibs.140.00.UWPDesktop_8wekyb3d8bbwe.appx
          Add-AppxPackage -Path .\Microsoft.VCLibs.140.00_8wekyb3d8bbwe.appx
          Invoke-WebRequest https://github.com/microsoft/winget-cli/releases/download/v1.0.11451/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle
          Add-AppxPackage -Path .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle
          # Create reparse point
          $installationPath = (Get-AppxPackage Microsoft.DesktopAppInstaller).InstallLocation
          Set-ExecutionAlias -Path "C:\Windows\System32\winget.exe" -PackageName "Microsoft.DesktopAppInstaller_8wekyb3d8bbwe" -EntryPoint "Microsoft.DesktopAppInstaller_8wekyb3d8bbwe!winget" -Target "$installationPath\AppInstallerCLI.exe" -AppType Desktop -Version 3
          explorer.exe "shell:appsFolder\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe!winget"
      - run: |
          winget --info

image

miketimofeev commented 2 years ago

Since the installer is not yet available I'm going to close the issue. Please feel free to reopen or contact us when the installer is generally available.

Croydon commented 2 years ago

Installers do exist on the release page...?

https://github.com/microsoft/winget-cli/releases

miketimofeev commented 2 years ago

@Croydon installation on windows server 2019 seems not supported yet https://github.com/microsoft/winget-cli/issues/702

nwmcsween commented 2 years ago

here is a smaller script that works on windows 2019 and windows server 2022, mostly from @al-cheb above

$ErrorActionPreference = 'Stop'

iwr $(iwr 'https://store.rg-adguard.net/api/GetFiles' -Method 'POST' -ContentType 'application/x-www-form-urlencoded' -Body 'type=PackageFamilyName&url=Microsoft.VCLibs.140.00_8wekyb3d8bbwe&ring=RP&lang=en-US' -UseBasicParsing | Foreach-Object Links | Where-Object outerHTML -match 'Microsoft.VCLibs.140.00_.+_x64__8wekyb3d8bbwe.appx' | Foreach-Object href) -OutFile $env:TEMP\vclibs.appx
iwr $(iwr 'https://store.rg-adguard.net/api/GetFiles' -Method 'POST' -ContentType 'application/x-www-form-urlencoded' -Body 'type=PackageFamilyName&url=Microsoft.VCLibs.140.00.UWPDesktop_8wekyb3d8bbwe&ring=RP&lang=en-US' -UseBasicParsing | Foreach-Object Links | Where-Object outerHTML -match 'Microsoft.VCLibs.140.00.UWPDesktop_.+_x64__8wekyb3d8bbwe.appx' | Foreach-Object href) -OutFile $env:TEMP\vclibsuwp.appx
iwr 'https://github.com/microsoft/winget-cli/releases/download/v1.1.12653/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle' -OutFile $env:TEMP\winget.msixbundle
iwr 'https://github.com/microsoft/winget-cli/releases/download/v1.1.12653/9c0fe2ce7f8e410eb4a8f417de74517e_License1.xml' -Outfile $env:TEMP\winget.license

Add-AppxProvisionedPackage -Online -PackagePath $env:TEMP\winget.msixbundle -LicensePath $env:TEMP\winget.license -DependencyPackagePath @("$env:TEMP\vclibs.appx", "$env:TEMP\vclibsuwp.appx")
Nelson-numerical-software commented 2 years ago

It is funny to have possibility to install a package with chocolatey and not with winget :( ...

miketimofeev commented 1 year ago

@vedantmgoyal2009 sorry, I'm not the part of the team anymore. @al-cheb @mikhailkoliada @ddobranic could you take a look?

ArjixWasTaken commented 1 year ago

how is this not done yet?

Cyberboss commented 1 year ago

I've created a simple action that does this on 2022 at least, 2019 doesn't work for now: https://github.com/marketplace/actions/install-winget

kit-ty-kate commented 4 months ago

It looks like Windows Server 2025 will have winget preinstalled according to https://techcommunity.microsoft.com/t5/windows-server-insiders/announcing-windows-server-preview-build-26063/m-p/4064942

DRSchlaubi commented 3 months ago

So ig the next question is, when will there be Windows Server 2025 runners?