Skip to content
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

Github Action to update winget package on release #141

Open
jo-chemla opened this issue Sep 10, 2024 · 4 comments
Open

Github Action to update winget package on release #141

jo-chemla opened this issue Sep 10, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jo-chemla
Copy link

jo-chemla commented Sep 10, 2024

Is your feature request related to a problem? Please describe.
I've just submitted a PR microsoft/winget-pkgs#172582 so that BlenderLauncher gets listed and can be installed on windows via winget install blender-launcher or winget install VictorIX.BlenderLauncher. I've used Komac to create the manifest files available in the PR - crediting your github profile, name etc.

It could be useful to add a github action on this repo so that the winget blender-launcher package gets updated on every github release.

Describe the solution you'd like

Here are two reference articles + action yml files made to keep the winget package up-to-date on every github release, via Github Actions. Requires a winget-token to be stored in security of the repo.

name: Publish to WinGet
on:
  release:
    types: [ released ]
jobs:
  publish:
    runs-on: windows-latest
    steps:
      - uses: vedantmgoyal9/winget-releaser@main
        with:
          identifier: Package.Identifier
          token: ${{ secrets.WINGET_TOKEN }}
          # installers-regex: '\.exe$' # Only .exe files
name: Submit Nushell package to Windows Package Manager Community Repository 

on:
  release:
    types: [published]

jobs:

  winget:
    name: Publish winget package
    runs-on: windows-latest
    steps:
      - name: Submit package to Windows Package Manager Community Repository
        run: |
          iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
          $github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
          $installerUrl = $github.release.assets | Where-Object -Property name -match 'windows.msi' | Select -ExpandProperty browser_download_url -First 1
          .\wingetcreate.exe update Nushell.Nushell -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.NUSHELL_PAT }}

Describe alternatives you've considered
Once the initial PR gets merged, anyone can update the BlenderLauncher package. But having a github action do it on every release would make sure the winget repo always has the latest version available

@Victor-IX
Copy link
Owner

Thanks for doing that!
I'll start this weekend implementing that

@jo-chemla
Copy link
Author

Great, thanks for doing it! Will tell you once the PR gets merged. Probably no need to setup the Github Action before that.
microsoft/winget-pkgs#172582

@jo-chemla
Copy link
Author

jo-chemla commented Sep 11, 2024

PR merged! Package available via a standard winget install VictorIX.BlenderLauncher

Since it uses Portable file, Blender-Launcher ends-up in C:\Users\username\AppData\Local\Microsoft\WinGet\Packages\VictorIX.BlenderLauncher_Microsoft.Winget.Source_8wekyb3d8bbwe\Blender launcher.exe but does not get added to windows start-menu. Winget adds it to path though, so can be run by running the "Blender Launcher.exe" from a terminal, with quotes since there is a space in exe filename.

Also, the -set-library-folder flag could maybe be exposed to the winget install options, not sure how I could do that I pinged the PR reviewer.

Here is another example github action workflow based on winget-releaser if you want to apply it to Blender-Launcher!

jo-chemla added a commit to jo-chemla/Blender-Launcher-V2 that referenced this issue Sep 12, 2024
Following issue Victor-IX#141 Uses [winget-releaser](https://github.com/vedantmgoyal9/winget-releaser) I suggest you ( @Victor-IX) create a `Classic Github Token` with `public_repo` scope is created, following [this link](https://github.com/settings/tokens/new), then the Token can be added to the Blender-Launcher-V2 repo as a secret named `WINGET_ACC_TOKEN`. See below, that user also will have to fork the winget-pkgs repository.

Notes:
> You will need to create a *classic* Personal Access Token (PAT) with `public_repo` scope. New fine-grained PATs aren't supported by the action. Review #172 for information.
> Fork [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) under the same account/organization as the project's repository. If you are forking winget-pkgs on a different account (e.g. bot/personal account), you can use the fork-user input to specify the username of the account where the fork is present.
@jo-chemla
Copy link
Author

Hi there, just made a quick PR as the basis for that github action: #142
Hope this iwll work-out! I added instructions as to how to setup the github classic token in the PR message.

@Victor-IX Victor-IX added enhancement New feature or request work in progress labels Sep 12, 2024
zeptofine pushed a commit that referenced this issue Oct 12, 2024
Following issue #141 Uses [winget-releaser](https://github.com/vedantmgoyal9/winget-releaser) I suggest you ( @Victor-IX) create a `Classic Github Token` with `public_repo` scope is created, following [this link](https://github.com/settings/tokens/new), then the Token can be added to the Blender-Launcher-V2 repo as a secret named `WINGET_ACC_TOKEN`. See below, that user also will have to fork the winget-pkgs repository.

Notes:
> You will need to create a *classic* Personal Access Token (PAT) with `public_repo` scope. New fine-grained PATs aren't supported by the action. Review #172 for information.
> Fork [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) under the same account/organization as the project's repository. If you are forking winget-pkgs on a different account (e.g. bot/personal account), you can use the fork-user input to specify the username of the account where the fork is present.
@Victor-IX Victor-IX moved this to Backlog in Blender Launcher V2 Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready
Development

No branches or pull requests

3 participants