Skip to content

Commit d20121c

Browse files
Lessley Denningtonvdye
authored andcommitted
Adding winget workflows
1 parent 6b7e624 commit d20121c

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "release-winget"
2+
on:
3+
release:
4+
types: [released]
5+
6+
workflow_dispatch:
7+
inputs:
8+
release:
9+
description: 'Release Id'
10+
required: true
11+
default: 'latest'
12+
13+
jobs:
14+
release:
15+
runs-on: windows-latest
16+
steps:
17+
- name: Publish manifest with winget-create
18+
run: |
19+
# Get correct release asset
20+
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
21+
$asset = $github.release.assets | Where-Object -Property name -match '64-bit.exe$'
22+
23+
# Remove 'v' and 'vfs' from the version
24+
$github.release.tag_name -match '\d.*'
25+
$version = $Matches[0] -replace ".vfs",""
26+
27+
# Download wingetcreate and create manifests
28+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
29+
.\wingetcreate.exe update Microsoft.Git -u $asset.browser_download_url -v $version -o manifests
30+
31+
# Manually substitute the name of the default branch in the License
32+
# and Copyright URLs since the tooling cannot do that for us.
33+
$shortenedVersion = $version -replace ".{4}$"
34+
$manifestPath = dir -Path ./manifests -Filter Microsoft.Git.locale.en-US.yaml -Recurse | %{$_.FullName}
35+
sed -i "s/vfs-[.0-9]*/vfs-$shortenedVersion/g" "$manifestPath"
36+
37+
# Submit manifests
38+
$manifestDirectory = Split-Path "$manifestPath"
39+
.\wingetcreate.exe submit -t "${{ secrets.WINGET_TOKEN }}" $manifestDirectory
40+
shell: powershell

0 commit comments

Comments
 (0)