-
Notifications
You must be signed in to change notification settings - Fork 822
30 lines (22 loc) · 1.09 KB
/
winget.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Publish to Winget
on:
release:
types: [published]
jobs:
publish:
if: github.event.release.prerelease == false
runs-on: windows-latest # Action can only run on Windows
steps:
- name: Publish WSL
run: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
$wingetRelevantAssetx64 = $assets | Where-Object { $_.name -like '*x64.msi' } | Select-Object -First 1
$wingetRelevantAssetARM64 = $assets | Where-Object { $_.name -like '*arm64.msi' } | Select-Object -First 1
$version = "${{ github.event.release.tag_name }}"
$wingetx64URL = $wingetRelevantAssetx64.browser_download_url
$wingetARM64URL = $wingetRelevantAssetARM64.browser_download_url
$wingetPackage = "Microsoft.WSL"
& curl.exe -JLO https://aka.ms/wingetcreate/latest
& .\wingetcreate.exe update $wingetPackage -s -v $version -u "$wingetx64URL|x64" "$wingetARM64URL|arm64" -t "${{ secrets.WINGET_TOKEN }}"