Victor-IX / Blender-Launcher-V2

Standalone client for managing official builds of Blender 3D
GNU General Public License v3.0
397 stars 18 forks source link

Github Action to update winget package on release #141

Open jo-chemla opened 1 month ago

jo-chemla commented 1 month ago

Is your feature request related to a problem? Please describe. I've just submitted a PR https://github.com/microsoft/winget-pkgs/pull/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 commented 1 month ago

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

jo-chemla commented 1 month ago

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

jo-chemla commented 1 month ago

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 commented 1 month ago

Hi there, just made a quick PR as the basis for that github action: https://github.com/Victor-IX/Blender-Launcher-V2/pull/142 Hope this iwll work-out! I added instructions as to how to setup the github classic token in the PR message.