trytriplex / triplex

The visual IDE for the web.
https://triplex.dev
GNU General Public License v3.0
820 stars 28 forks source link

Github Action to update winget package on release for `Triplex.Triplex` #218

Closed jo-chemla closed 2 months ago

jo-chemla commented 2 months ago

I've just submitted a PR - now merged 🚀 - https://github.com/microsoft/winget-pkgs/pull/172824 so that Triplex had been listed and can be installed on windows via winget install triplex or winget install Triplex.Triplex. I've used Komac to create the manifest file, crediting your github profile, name etc.

It could be useful to add a Github Action workflow on this repo so that the winget package gets updated on every github release. Having a github action do it on every release would make sure the winget repo always has the latest version available. Note I did the same request for github action workflow for BlenderLauncher which I also added to winget-pkgs, see https://github.com/Victor-IX/Blender-Launcher-V2/issues/141.

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 }}

~Note installer might install portable app to C:\Users\username\AppData\Local\Microsoft\WinGet\Packages and not add it to start-menu entries, see https://github.com/microsoft/winget-cli/issues/2299~

itsdouges commented 2 months ago

Oh hey mate, can you tell me more about what winget is? Is it like homebrew for macOS?

jo-chemla commented 2 months ago

Exactly, it's the default windows package manager, that has shipped natively with windows for a few years. Makes it easier to install a bunch of apps in one command, or also rely on apps like UnigetUI/formerly WingetUI. Helper webapps like winstall.app make it easier to package lists.

itsdouges commented 2 months ago

Interesting! TIL. @krispya have you used it?

Is raising a PR the canonical way of getting updates into it? Ideally the flow would be:

itsdouges commented 2 months ago

Note installer might install portable app to C:\Users\username\AppData\Local\Microsoft\WinGet\Packages and not add it to start-menu entries, see https://github.com/microsoft/winget-cli/issues/2299

Did you cross this out because Triplex doesn't currently ship a portable install? For clarity I did that because I want to make sure folks continue getting updates.

itsdouges commented 2 months ago

I'd be happy to accept a contribution to this repo to set this all up. As a side have you been added to the vscode early adopters channel? What's your Discord name I'll add you.

jo-chemla commented 2 months ago

Thabks for the feedback.

itsdouges commented 2 months ago

Come join first https://discord.gg/22fQ9acT

itsdouges commented 2 months ago

Want to put up a PR to add the Github action? Where do we get a WINGET_TOKEN from?

jo-chemla commented 2 months ago

Just submitted this as a PR https://github.com/try-triplex/triplex/pull/220 With instructions as to how to get the github classic token in the PR thread.

And also I just joined the triplex discord - although I'm not using it often!

itsdouges commented 2 months ago

Done! Thanks mate.

jo-chemla commented 1 month ago

Glad it worked! Nice to see these auto-PRs by triplex-bot to winget-pkgs repo for every new triplex release!