File tree 2 files changed +102
-0
lines changed
2 files changed +102
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Update Homebrew Tap
2
+ on :
3
+ release :
4
+ types : [released]
5
+
6
+ permissions :
7
+ id-token : write # required for Azure login via OIDC
8
+
9
+ jobs :
10
+ release :
11
+ runs-on : ubuntu-latest
12
+ environment : release
13
+ steps :
14
+ - id : version
15
+ name : Compute version number
16
+ run : |
17
+ echo "result=$(echo $GITHUB_REF | sed -e "s/^refs\/tags\/v//")" >>$GITHUB_OUTPUT
18
+ - id : hash
19
+ name : Compute release asset hash
20
+ uses :
mjcheetham/[email protected]
21
+ with :
22
+ asset : /git-(.*)\.pkg/
23
+ hash : sha256
24
+ token : ${{ secrets.GITHUB_TOKEN }}
25
+ - name : Log into Azure
26
+ uses : azure/login@v2
27
+ with :
28
+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
29
+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
30
+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
31
+ - name : Retrieve token
32
+ id : token
33
+ run : |
34
+ az keyvault secret show \
35
+ --name ${{ secrets.HOMEBREW_TOKEN_SECRET_NAME }} \
36
+ --vault-name ${{ secrets.AZURE_VAULT }} \
37
+ --query "value" -o tsv >token &&
38
+ # avoid outputting the token under `set -x` by using `sed` instead of `echo`
39
+ sed s/^/::add-mask::/ <token &&
40
+ sed s/^/result=/ <token >>$GITHUB_OUTPUT &&
41
+ rm token
42
+ - name : Update scalar Cask
43
+ uses :
mjcheetham/[email protected]
44
+ with :
45
+ token : ${{ steps.token.outputs.result }}
46
+ tap : microsoft/git
47
+ name : microsoft-git
48
+ type : cask
49
+ version : ${{ steps.version.outputs.result }}
50
+ sha256 : ${{ steps.hash.outputs.result }}
51
+ alwaysUsePullRequest : false
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