Skip to content

Create winget-submission.yml #3729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Create winget-submission.yml #3729

wants to merge 3 commits into from

Conversation

matifali
Copy link
Member

@matifali matifali commented Aug 29, 2022

This PR adds a GitHub action to publish every release to winget

Subtasks

  • packageFileName: coder_${VERSION}_windows_amd64.zip # Need to get VERSION from latest release to use here
  • packageId: MyPackageIdInWinget # Need to ge an official Winget Package ID
  • secrets.Project_PAT # generate a PAT with the scope public_repo and add it to your project's secrets with the name Project_PAT.
  • Resolve wingetcreate issue with portable apps.

Partially resolves #3714

  packageFileName: coder_${VERSION}_windows_amd64.zip    # Need to get VERSION from latest release to use here
  packageId: MyPackageIdInWinget  # Need to ge an official Winget Package ID
ecrets.Project_PAT  # generate a PAT with the scope public_repo and add it to the secrets of your project with the name Project_PAT
@matifali matifali marked this pull request as ready for review August 29, 2022 15:07
@matifali matifali marked this pull request as draft August 29, 2022 15:07
@matifali
Copy link
Member Author

Can you take a look at this? @bpmct

@matifali matifali marked this pull request as ready for review September 8, 2022 08:55
@bpmct
Copy link
Member

bpmct commented Sep 9, 2022

Hey! Sorry for the late response - I'm looking at publishing the first package now so we can get the ID and then update via this action

@matifali
Copy link
Member Author

matifali commented Sep 9, 2022

Hey! Sorry for the late response - I'm looking at publishing the first package now so we can get the ID and then update via this action

Sure, link it here when you are done.

@bpmct
Copy link
Member

bpmct commented Sep 9, 2022

@matifali It seems like Winget very recently added support for portable apps (standalone .exe) and it's somewhat new and experimental. For example, I can't figure out how to create the app with wingetcreate https://github.com/coder/coder/releases/download/v0.8.14/coder_0.8.14_windows_amd64.zip as it's expecting a MSI file or similar, not a standalone exe.

Ah, I just saw this in the v1.3 release.

Note: The Windows Package Manager Community Repository does not accept portable applications. They will not be accepted until after 1.3 is Generally Available and has been rolled out to the majority of Windows systems via the automatic upgrade from the Microsoft Store. Users may test with local manifests.

I also haven't been able to test with a local manifest. This does not seem to be working for me. Any ideas?

# turn on install from file
winget settings --enable LocalManifestFiles

# install
winget install -m coder.yaml
Id: Coder.Coder
Name: Coder
Description: Remote development environments on your infrastructure provisioned with Terraform
Version: 0.8.14
Publisher: Coder
License: AGPL-3.0, Unknown licenses found
Homepage: https://github.com/coder/coder
Tags: portable
Installers:  
  - Arch: x64
    InstallerType: exe
    Url: https://github.com/coder/coder/releases/download/v0.8.14/coder_0.8.14_windows_amd64.zip
    Sha256: 435cc6a195c7af4a210d90ed78f59f802407caf6740986087f4e2ae983b7d3f8

@matifali
Copy link
Member Author

matifali commented Sep 9, 2022

By modifying the manifest file as per the latest singelton schema, although for community repo submission, we need three files schemas (wingetcreate will generate them automatically)

PackageIdentifier: Coder.Coder
PackageVersion: 0.8.14
PackageLocale: en-US
Publisher: Coder
PackageName: Coder
License: AGPL-3.0, Unknown licenses found
ShortDescription: Remote development environments on your infrastructure provisioned with Terraform
Installers:
 - Architecture: x64
   InstallerType: portable
   InstallerLocale: en-US
   Commands: [coder]
   InstallerUrl: https://github.com/coder/coder/releases/download/v0.8.14/coder_0.8.14_windows_amd64.zip
   InstallerSha256: 435cc6a195c7af4a210d90ed78f59f802407caf6740986087f4e2ae983b7d3f8
   InstallModes:
    - silent
ManifestType: singleton
ManifestVersion: 1.2.0

I was able to install it locally and reached up to this point.

PS C:\Users\matif> winget install -m coder.yaml
Found Coder [Coder.Coder] Version 0.8.14
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/coder/coder/releases/download/v0.8.14/coder_0.8.14_windows_amd64.zip
  ██████████████████████████████   112 MB /  112 MB
Successfully verified installer hash
Starting package install...
Overwriting existing file: C:\Users\matif\AppData\Local\Microsoft\WinGet\Links\coder_0.8.14_windows_amd64.exe
Successfully installed

PS C:\Users\matif> coder
ResourceUnavailable: Program 'coder.exe' failed to run: An error occurred trying to start process 'C:\Users\matif\AppData\Local\Microsoft\WinGet\Links\coder.exe' with working directory 'C:\Users\matif'. The specified executable is not a valid application for this OS platform.At line:1 char:1
+ coder
+ ~~~~~.

@matifali
Copy link
Member Author

matifali commented Sep 9, 2022

@bpmct

For example, I can't figure out how to create the app with wingetcreate https://github.com/coder/coder/releases/download/v0.8.14/coder_0.8.14_windows_amd64.zip as it's expecting an MSI file or similar, not a standalone exe.

wingetcreate 1.1.2.0 does support creating manifests for portable apps, but I am not sure if it accepts a zip instead of an exe
May be coder should publish .exe for windows instead of .zip

There seems to be a known bug microsoft/winget-create#302 for why this is not working.

@bpmct
Copy link
Member

bpmct commented Sep 19, 2022

Hmm ok. I will follow the issue there. It seems like this doesn't work with exe either, given that issue and the fact that it unzipped things fine

@bpmct
Copy link
Member

bpmct commented Sep 19, 2022

ResourceUnavailable: Program 'coder.exe' failed to run: An error occurred trying to start process 'C:\Users\matif\AppData\Local\Microsoft\WinGet\Links\coder.exe' with working directory 'C:\Users\matif'. The specified executable is not a valid application for this OS platform.At line:1 char:1

How to we get past this? I ran into the same thing and it seems to be exclusive to winget

@matifali
Copy link
Member Author

matifali commented Sep 20, 2022

ResourceUnavailable: Program 'coder.exe' failed to run: An error occurred trying to start process 'C:\Users\matif\AppData\Local\Microsoft\WinGet\Links\coder.exe' with working directory 'C:\Users\matif'. The specified executable is not a valid application for this OS platform.At line:1 char:1

How to we get past this? I ran into the same thing and it seems to be exclusive to winget

Yes, it seems like it is installing it, and binary is on the path but can't execute. I will try to find the reason soon. It has to do something with 'App Execution Alias'.

@matifali
Copy link
Member Author

matifali commented Sep 23, 2022

https://github.com/microsoft/winget-pkgs/tree/master/manifests/r/RussellBanks/winfetch/2.4.1
Check this for reference. This is a portable app published on winget. It is using YamlCreate.ps1 to generate manifests.

@github-actions
Copy link

github-actions bot commented Oct 1, 2022

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Oct 1, 2022
@github-actions github-actions bot closed this Oct 5, 2022
@deansheather
Copy link
Member

Now that we have the installer this can be reopened and updated. The installer URL should be the asset URL from the release (e.g. https://github.com/coder/coder/releases/download/v0.11.0/coder_0.11.0_windows_amd64_installer.exe) and should have the same fields as the package I submitted manually: microsoft/winget-pkgs#86238

Comment on lines +7 to +10
env:
version: "$(git describe --tags --abbrev=0)"
packageFileName: coder_${version}_windows_amd64.zip
packageId: Coder.Coder # Most probably the id of coder package
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These env vars should be in UPPER_SNAKE_CASE format like normal env vars, and should be referenced by "$NAME" in the script below instead of using ${env:NAME} as they have different semantics

types: [published]

env:
version: "$(git describe --tags --abbrev=0)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency we should stick to ./scripts/version.sh. Also, instead of having an evaluated statement here (which doesn't get evaluated instantly), you should just have these be variables in the script instead.

@@ -0,0 +1,23 @@
name: Submit package to Windows Package Manager Community Repository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just be called submit-packages.yml and "Submit packages" so we can use it for other package managers in the future

@ghuntley ghuntley mentioned this pull request Nov 14, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows packages (winget, choco, etc)
3 participants