Skip to content

Commit

Permalink
Add action for publishing package to WinGet
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanish-kh committed Jan 4, 2025
1 parent 76f2bea commit 6dfb80c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/submit-winget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Submit published release to WinGet community repository

on:
release:
types: [published]

jobs:
publish-winget:
name: Submit to WinGet repository
runs-on: windows-latest
steps:
- name: Sync winget-pkgs fork
# TODO: Replace <repo-owner> with the owner of the fork
run: gh repo sync <repo-owner>/winget-pkgs -b master
env:
GH_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }}
- name: Submit package using wingetcreate
run: |
# Get installer info from release event
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
$x64InstallerUrl = $assets | Where-Object -Property name -match 'dev-proxy-installer-win-x64-v.*exe$' | Select-Object -First 1 | Select -ExpandProperty browser_download_url
$packageVersion = (${{ toJSON(github.event.release.tag_name) }}).Trim('v')
$isPrerelease = '${{ toJSON(github.event.release.prerelease) }}' | ConvertFrom-Json
# WinGet PackageIdentifier
$packageId = $isPrerelease ? "Microsoft.DevProxy.Beta" : "Microsoft.DevProxy"
# Update package using wingetcreate
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $packageId --version $packageVersion --urls "$x64InstallerUrl|x64" --token "${{ secrets.WINGET_GITHUB_TOKEN }}"

0 comments on commit 6dfb80c

Please sign in to comment.