Skip to content

Commit 90d5460

Browse files
authored
homebrew: switch to using an Azure Key Vault secret (git-for-windows#703)
This is a companion to git-for-windows#702: Instead of storing the token used for the Homebrew release workflow, let's retrieve it from the Key Vault that already is used to store such information.
2 parents cde0eef + 9d0bdfc commit 90d5460

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/release-homebrew.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
release:
44
types: [released]
55

6+
permissions:
7+
id-token: write # required for Azure login via OIDC
8+
69
jobs:
710
release:
811
runs-on: ubuntu-latest
@@ -19,10 +22,27 @@ jobs:
1922
asset: /git-(.*)\.pkg/
2023
hash: sha256
2124
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
2242
- name: Update scalar Cask
2343
uses: mjcheetham/[email protected]
2444
with:
25-
token: ${{ secrets.HOMEBREW_TOKEN }}
45+
token: ${{ steps.token.outputs.result }}
2646
tap: microsoft/git
2747
name: microsoft-git
2848
type: cask

0 commit comments

Comments
 (0)