Skip to content

Commit

Permalink
Add winget.yml to automate winget requests (#12026)
Browse files Browse the repository at this point in the history
* Revert "Removed winget.yml"

This reverts commit f32da00.

* Updated to be release only

* updates from PR
  • Loading branch information
craigloewen-msft authored Oct 3, 2024
1 parent 8a44e9d commit a7eaca8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/winget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 }}"

0 comments on commit a7eaca8

Please sign in to comment.