PowerToys/.github/workflows/package-submissions.yml
2022-05-03 11:55:25 -07:00

30 lines
1.2 KiB
YAML

name: Submit Microsoft.PowerToys package to Windows Package Manager Community Repository
# based off of https://github.com/nushell/nushell/blob/main/.github/workflows/winget-submission.yml
on:
workflow_dispatch:
release:
types: [published]
jobs:
winget:
name: Publish winget package
runs-on: windows-latest
steps:
- name: Submit package to Windows Package Manager Community Repository
run: |
$wingetPackage = "Microsoft.PowerToys"
$gitToken = "${{ secrets.PT_WINGET }}"
$github = Invoke-RestMethod -uri "https://api.github.com/repos/Microsoft/PowerToys/releases"
$targetRelease = $github | Where-Object -Property name -match 'Release'| Select -First 1
$installerUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup' | Select -ExpandProperty browser_download_url
$ver = $targetRelease.tag_name.Trim("v")
# getting latest wingetcreate file
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $wingetPackage -s -v $ver -u $installerUrl -t $gitToken