File tree 1 file changed +51
-0
lines changed 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments