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

Add publishing to winget #795

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}"