Skip to content

Commit 528a3af

Browse files
Copilotdscho
andcommitted
fixup! Add --ref-format option to scalar clone (#829)
release-winget: use WINGET_CREATE_GITHUB_TOKEN environment variable According to the winget-create documentation, for CI/CD scenarios it is recommended to use the WINGET_CREATE_GITHUB_TOKEN environment variable to pass the token to wingetcreate.exe rather than the -t command-line flag. The concern is that command-line arguments might be logged in process listings, whereas environment variables are more secure as they are not typically exposed in such listings. This change: - Retrieves the token from Azure Key Vault directly into a variable using `az keyvault secret show` instead of downloading to a file - Sets the WINGET_CREATE_GITHUB_TOKEN environment variable - Removes the -t flag from the wingetcreate.exe submit command - Removes the need for the token.txt file Co-authored-by: dscho <[email protected]>
1 parent eaa273d commit 528a3af

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

.github/workflows/release-winget.yml

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

30-
- name: Create manifests with winget-create
31-
id: manifests
30+
- name: Publish manifest with winget-create
3231
run: |
3332
# Enabling stop on error and tracing
3433
Set-PSDebug -Trace 2
@@ -73,30 +72,12 @@ jobs:
7372
"$($asset_arm64_url)|arm64|machine" `
7473
"$($asset_arm64_url)|arm64|user"
7574
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
75+
# Download the token from Azure Key Vault and set the environment variable
76+
$env:WINGET_CREATE_GITHUB_TOKEN = az keyvault secret show --name ${{ secrets.WINGET_TOKEN_SECRET_NAME }} --vault-name ${{ secrets.AZURE_VAULT }} --query "value" -o tsv
77+
Write-Host -NoNewLine "::add-mask::$env:WINGET_CREATE_GITHUB_TOKEN"
9478
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... "
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... "
9982
.\wingetcreate.exe submit $manifestDirectory
10083
shell: powershell
101-
env:
102-
WINGET_CREATE_GITHUB_TOKEN: ${{ steps.token.outputs.result }}

0 commit comments

Comments
 (0)