Skip to content

Commit 6c16799

Browse files
authored
Merge pull request #1940 from tgauth/add-release-to-winget
Add Release to WinGet GitHub Workflow
2 parents ad3edb4 + 2f76031 commit 6c16799

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/releaseToWinGet.yml

+56
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.tag_name
28+
forEach ($filename in $releaseInfo.assets.name) {
29+
if ($filename.split(".")[-1] -contains "msi") {
30+
if ($filename.split("-")[1] -contains "Win32") {
31+
$msi_x86 = "https://github.com/$repo/releases/download/$tag/$filename"
32+
}
33+
if ($filename.split("-")[1] -contains "Win64") {
34+
$msi_x64 = "https://github.com/$repo/releases/download/$tag/$filename"
35+
}
36+
}
37+
}
38+
echo "URL_X86=$msi_x86" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
39+
echo "URL_X64=$msi_x64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
40+
name: Get Release URLs
41+
42+
- run: |
43+
# Download and install C++ Runtime framework package.
44+
Import-Module Appx -UseWindowsPowerShell
45+
iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile vcLibsBundle.appx
46+
Add-AppxPackage vcLibsBundle.appx
47+
48+
# Download Winget-Create msixbundle, install, and execute update.
49+
iwr https://aka.ms/wingetcreate/latest/msixbundle -OutFile winGetBundle.appx
50+
Add-AppxPackage winGetBundle.appx
51+
name: Download WinGet Requirements
52+
53+
- run: |
54+
# wingetcreate update Microsoft.OpenSSH.Beta -u @($env:URL_X86, $env:URL_X64) -o $env:GITHUB_WORKSPACE
55+
wingetcreate update Microsoft.OpenSSH.Beta -u @($env:URL_X86, $env:URL_X64) -t ${{ secrets.WINGETTOKEN }} --submit
56+
name: WinGet Update

0 commit comments

Comments
 (0)