PowerToys/.github/workflows/package-submissions.yml

32 lines
1.9 KiB
YAML
Raw Normal View History

name: Submit Microsoft.PowerToys package to Windows Package Manager Community Repository
2022-05-03 00:37:30 +08:00
# 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: |
2022-05-03 00:37:30 +08:00
$wingetPackage = "Microsoft.PowerToys"
2022-05-04 02:55:25 +08:00
$gitToken = "${{ secrets.PT_WINGET }}"
2022-05-03 01:38:15 +08:00
$github = Invoke-RestMethod -uri "https://api.github.com/repos/Microsoft/PowerToys/releases"
2022-05-03 01:42:44 +08:00
$targetRelease = $github | Where-Object -Property name -match 'Release'| Select -First 1
$installerUserX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*x64' | Select -ExpandProperty browser_download_url
$installerMachineX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
$installerUserArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*arm64' | Select -ExpandProperty browser_download_url
$installerMachineArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
2022-05-03 01:42:44 +08:00
$ver = $targetRelease.tag_name.Trim("v")
2022-05-03 01:38:15 +08:00
# getting latest wingetcreate file
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerUserX64Url|user" "$installerMachineX64Url|machine" "$installerUserArmUrl|user" "$installerMachineArmUrl|machine" -t $gitToken