Skip to content

Commit eaa273d

Browse files
Copilotdscho
andcommitted
Use WINGET_CREATE_GITHUB_TOKEN env var instead of -t flag for wingetcreate
Co-authored-by: dscho <[email protected]>
1 parent f423528 commit eaa273d

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.github/workflows/release-winget.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
2828
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
2929

30-
- name: Publish manifest with winget-create
30+
- name: Create manifests with winget-create
31+
id: manifests
3132
run: |
3233
# Enabling stop on error and tracing
3334
Set-PSDebug -Trace 2
@@ -72,12 +73,30 @@ jobs:
7273
"$($asset_arm64_url)|arm64|machine" `
7374
"$($asset_arm64_url)|arm64|user"
7475
75-
# Download the token from Azure Key Vault and mask it in the logs
76-
az keyvault secret download --name ${{ secrets.WINGET_TOKEN_SECRET_NAME }} --vault-name ${{ secrets.AZURE_VAULT }} --file token.txt
77-
Write-Host -NoNewLine "::add-mask::$(Get-Content token.txt)"
76+
# Output the version and tag name for use in the next step
77+
"version=$version" >> $env:GITHUB_OUTPUT
78+
"tag_name=$env:TAG_NAME" >> $env:GITHUB_OUTPUT
79+
shell: powershell
80+
81+
- name: Retrieve winget token
82+
id: token
83+
run: |
84+
$token = az keyvault secret show `
85+
--name ${{ secrets.WINGET_TOKEN_SECRET_NAME }} `
86+
--vault-name ${{ secrets.AZURE_VAULT }} `
87+
--query "value" -o tsv
88+
if ([string]::IsNullOrWhiteSpace($token)) {
89+
throw "Failed to retrieve token from Azure Key Vault"
90+
}
91+
Write-Host -NoNewLine "::add-mask::$token"
92+
"result=$token" >> $env:GITHUB_OUTPUT
93+
shell: powershell
7894

79-
# Submit the manifest to the winget-pkgs repository
80-
$manifestDirectory = "$PWD\manifests\m\Microsoft\Git\$version"
81-
Write-Host -NoNewLine "::notice::Submitting ${env:TAG_NAME} to winget... "
82-
.\wingetcreate.exe submit -t "$(Get-Content token.txt)" $manifestDirectory
95+
- name: Submit manifest to winget-pkgs
96+
run: |
97+
$manifestDirectory = "$PWD\manifests\m\Microsoft\Git\${{ steps.manifests.outputs.version }}"
98+
Write-Host -NoNewLine "::notice::Submitting ${{ steps.manifests.outputs.tag_name }} to winget... "
99+
.\wingetcreate.exe submit $manifestDirectory
83100
shell: powershell
101+
env:
102+
WINGET_CREATE_GITHUB_TOKEN: ${{ steps.token.outputs.result }}

0 commit comments

Comments
 (0)