Skip to content

Commit

Permalink
Add publishing to winget (#795)
Browse files Browse the repository at this point in the history
* Add publishing to winget

* New version of action checkout

Co-authored-by: Sean Feldman <SeanFeldman@users.noreply.github.com>
  • Loading branch information
ErikMogensen and SeanFeldman committed Jul 15, 2024
1 parent 87df21f commit 8b1faa0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/handle-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
echo $hash
- name: Checkout main
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/winget-submission.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: WinGet submission on release
# based off of https://github.com/microsoft/PowerToys/blob/main/.github/workflows/package-submissions.yml and https://github.com/microsoft/terminal/blob/main/.github/workflows/winget.yml

on:
release:
types: [published]

env:
VERSION_REGEX: 'ServiceBusExplorer-([\d.]+)(?:-preview)?\.zip$'

jobs:
winget:
name: Publish winget package
runs-on: windows-2022
steps:
- name: Submit PaoloSalvatori.ServiceBusExplorer ${{ github.event.release.prerelease && 'Preview' || 'Stable' }}
run: |
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
$wingetRelevantAsset = $assets | Where-Object { $_.name -like '*.zip' } | Select-Object -First 1
$regex = [Regex]::New($env:VERSION_REGEX)
$version = $regex.Match($wingetRelevantAsset.name).Groups[1].Value
$wingetPackage = "PaoloSalvatori.ServiceBusExplorer${{ github.event.release.prerelease && '.Preview' || '' }}"
# Get the latest wingetcreate file
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
# Submit a PR for the package
.\wingetcreate.exe update $wingetPackage --submit --version $version --urls $wingetRelevantAsset.browser_download_url --token "${{ secrets.GITHUB_TOKEN }}"

0 comments on commit 8b1faa0

Please sign in to comment.