Skip to content

Commit 8b6d6a0

Browse files
Lessley Denningtondscho
Lessley Dennington
authored andcommitted
Adding winget workflows
1 parent f6811a4 commit 8b6d6a0

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/release-winget.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
permissions:
14+
id-token: write # required for Azure login via OIDC
15+
16+
jobs:
17+
release:
18+
runs-on: windows-latest
19+
environment: release
20+
steps:
21+
- name: Log into Azure
22+
uses: azure/login@v2
23+
with:
24+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
25+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
26+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
27+
28+
- name: Publish manifest with winget-create
29+
run: |
30+
# Get correct release asset
31+
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
32+
$asset = $github.release.assets | Where-Object -Property name -match '64-bit.exe$'
33+
34+
# Remove 'v' and 'vfs' from the version
35+
$github.release.tag_name -match '\d.*'
36+
$version = $Matches[0] -replace ".vfs",""
37+
38+
# Download wingetcreate and create manifests
39+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
40+
.\wingetcreate.exe update Microsoft.Git -u $asset.browser_download_url -v $version -o manifests
41+
42+
# Manually substitute the name of the default branch in the License
43+
# and Copyright URLs since the tooling cannot do that for us.
44+
$shortenedVersion = $version -replace ".{4}$"
45+
$manifestPath = dir -Path ./manifests -Filter Microsoft.Git.locale.en-US.yaml -Recurse | %{$_.FullName}
46+
sed -i "s/vfs-[.0-9]*/vfs-$shortenedVersion/g" "$manifestPath"
47+
48+
# Submit manifests
49+
$manifestDirectory = Split-Path "$manifestPath"
50+
.\wingetcreate.exe submit -t "(az keyvault secret show --name ${{ secrets.WINGET_TOKEN_SECRET_NAME }} --vault-name ${{ secrets.AZURE_VAULT }} --query "value")" $manifestDirectory
51+
shell: powershell

0 commit comments

Comments
 (0)