Skip to content

Commit f08193e

Browse files
Lessley Denningtondscho
authored andcommitted
Adding winget workflows
1 parent 226ddca commit f08193e

File tree

1 file changed

+41
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)