Skip to content

Commit f731531

Browse files
committed
add GH Workflow for WinGet updates
1 parent ad3edb4 commit f731531

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

releaseToWinGet.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the BSD license.
3+
4+
name: Release to WinGet
5+
6+
on:
7+
workflow_dispatch:
8+
release:
9+
types: [created]
10+
11+
defaults:
12+
run:
13+
shell: pwsh
14+
15+
env:
16+
PACKAGE_URLS: ""
17+
18+
jobs:
19+
release-to-winget:
20+
runs-on: windows-latest
21+
22+
steps:
23+
- run: |
24+
$repo = "powershell/win32-openssh"
25+
$releases = "https://api.github.com/repos/$repo/releases"
26+
$releaseInfo = (Invoke-WebRequest $releases | ConvertFrom-Json)[0]
27+
$tag = $releaseInfo.tagname
28+
forEach ($filename in $releaseInfo.assets.name) {
29+
if ($filename.split(".")[-1] -contains "msi") {
30+
if ($filename.split("-")[1] -contains "Win32") {
31+
$msi_x86 = $filename
32+
}
33+
if ($filename.split("-")[1] -contains "Win64") {
34+
$msi_x64 = $filename
35+
}
36+
}
37+
}
38+
$urls = "https://github.com/$repo/releases/download/$tag/$msi_x64, https://github.com/$repo/releases/download/$tag/$msi_x86"
39+
echo "::set-env name=PACKAGE_URLS::$urls"
40+
name: Get Release URLs
41+
42+
- run: |
43+
# Download and install C++ Runtime framework package.
44+
iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile vcLibsBundle.appx
45+
Add-AppxPackage vcLibsBundle.appx
46+
47+
# Download Winget-Create msixbundle, install, and execute update.
48+
iwr https://aka.ms/wingetcreate/latest/msixbundle -OutFile winGetBundle.appx
49+
Add-AppxPackage winGetBundle.appx
50+
name: Download WinGet Requirements
51+
52+
- run: |
53+
echo " wingetcreate update Microsoft.OpenSSH -u ${PACKAGE_URLS} -o ${GITHUB_WORKSPACE}"
54+
wingetcreate update Microsoft.OpenSSH -u ${PACKAGE_URLS} -o ${GITHUB_WORKSPACE}
55+
# wingetcreate update Microsoft.OpenSSH -u ${PACKAGE_URLS} -t ${{ secrets.GITHUB_TOKEN }} --submit
56+
name: WinGet Update

0 commit comments

Comments
 (0)