Skip to content

Commit 03f0a76

Browse files
committed
ci(github workflows): update release pipeline configuration
- remove redundant line ending normalization comment and empty lines - update regex pattern to more accurately extract changelog content - simplify log output and remove extra character cleaning steps - improve github output writing with utf8NoBOM encoding - add fallback logic when no changelog content is found - simplify release body to use extracted changelog instead of hardcoded template - refactor microsoft store auth step: pass secrets via env vars, add debug logs and manual token test - update msstore command to use environment variables instead of direct secrets reference
1 parent 103effb commit 03f0a76

1 file changed

Lines changed: 45 additions & 25 deletions

File tree

.github/workflows/release.yml

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ jobs:
3535
shell: pwsh
3636
run: |
3737
$content = Get-Content CHANGELOG.md -Raw
38-
39-
# Normalize line endings
4038
$content = $content -replace "`r`n", "`n"
4139
4240
if ($content -match '##\s*\[(\d+\.\d+\.\d+)\]\s*-\s*\d{4}-\d{2}-\d{2}') {
@@ -48,16 +46,16 @@ jobs:
4846
exit 1
4947
}
5048
51-
$pattern = '(?s)##\s*\[\d+\.\d+\.\d+\].*?\n(.*?)(?=\n##|\Z)'
49+
$pattern = '(?s)(## \[.*?\].*?)(?=\n---|\Z)'
5250
if ($content -match $pattern) {
5351
$changelogContent = $matches[1].Trim()
54-
$changelogContent = $changelogContent -replace '### ', '' -replace '\*\*', '' -replace '\* ', '- ' -replace '\n\n', "`n" -replace '\n\n\n', "`n"
55-
$changelogContent = $changelogContent.Substring(0, [Math]::Min(500, $changelogContent.Length))
56-
5752
Write-Host "Extracted changelog (first 200 chars): $($changelogContent.Substring(0, [Math]::Min(200, $changelogContent.Length)))"
58-
"CHANGELOG<<EOF" >> $env:GITHUB_OUTPUT
59-
$changelogContent >> $env:GITHUB_OUTPUT
60-
"EOF" >> $env:GITHUB_OUTPUT
53+
"CHANGELOG<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8NoBOM
54+
$changelogContent | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8NoBOM
55+
"EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8NoBOM
56+
} else {
57+
Write-Host "No changelog content found"
58+
"CHANGELOG=" >> $env:GITHUB_OUTPUT
6159
}
6260
6361
build-installer:
@@ -387,18 +385,7 @@ jobs:
387385
with:
388386
tag_name: v${{ needs.extract-version.outputs.version }}
389387
name: DevTools v${{ needs.extract-version.outputs.version }}
390-
body: |
391-
${{ needs.extract-version.outputs.changelog }}
392-
393-
## Downloads
394-
395-
### Installers
396-
- DevTools-win-x86.exe - Windows 32-bit installer
397-
- DevTools-win-x64.exe - Windows 64-bit installer
398-
- DevTools-win-arm64.exe - Windows ARM64 installer
399-
400-
### MSIX Bundle
401-
- DevTools_${{ needs.extract-version.outputs.version }}_bundle.msixbundle - Microsoft Store package (includes x64, x86, arm64)
388+
body: ${{ needs.extract-version.outputs.changelog }}
402389
draft: false
403390
prerelease: false
404391
files: |
@@ -447,12 +434,45 @@ jobs:
447434

448435
- name: Reconfigure store credentials
449436
shell: pwsh
437+
env:
438+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
439+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
440+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
441+
SELLER_ID: ${{ secrets.SELLER_ID }}
450442
run: |
443+
Write-Host "=== Debug: Checking secrets ==="
444+
Write-Host "AZURE_TENANT_ID exists: $([bool]$env:AZURE_TENANT_ID)"
445+
Write-Host "AZURE_CLIENT_ID exists: $([bool]$env:AZURE_CLIENT_ID)"
446+
Write-Host "AZURE_CLIENT_SECRET exists: $([bool]$env:AZURE_CLIENT_SECRET)"
447+
Write-Host "SELLER_ID exists: $([bool]$env:SELLER_ID)"
448+
449+
Write-Host "`n=== Testing Azure AD token manually ==="
450+
$tokenBody = @{
451+
grant_type = "client_credentials"
452+
client_id = $env:AZURE_CLIENT_ID
453+
client_secret = $env:AZURE_CLIENT_SECRET
454+
resource = "https://manage.devcenter.microsoft.com"
455+
}
456+
try {
457+
$tokenResponse = Invoke-RestMethod -Uri "https://login.microsoftonline.com/$env:AZURE_TENANT_ID/oauth2/token" -Method POST -Body $tokenBody
458+
Write-Host "✓ Token obtained successfully"
459+
Write-Host "Token type: $($tokenResponse.token_type)"
460+
Write-Host "Expires in: $($tokenResponse.expires_in) seconds"
461+
} catch {
462+
Write-Host "✗ Token request failed:"
463+
Write-Host "Error: $($_.Exception.Message)"
464+
if ($_.Exception.Response) {
465+
$reader = [System.IO.StreamReader]::new($_.Exception.Response.GetResponseStream())
466+
Write-Host "Response: $($reader.ReadToEnd())"
467+
}
468+
}
469+
470+
Write-Host "`n=== Running msstore reconfigure ==="
451471
msstore reconfigure `
452-
--tenantId ${{ secrets.AZURE_TENANT_ID }} `
453-
--sellerId ${{ secrets.SELLER_ID }} `
454-
--clientId ${{ secrets.AZURE_CLIENT_ID }} `
455-
--clientSecret ${{ secrets.AZURE_CLIENT_SECRET }}
472+
--tenantId $env:AZURE_TENANT_ID `
473+
--sellerId $env:SELLER_ID `
474+
--clientId $env:AZURE_CLIENT_ID `
475+
--clientSecret $env:AZURE_CLIENT_SECRET
456476
457477
- name: Publish MSIX bundle to Store
458478
shell: pwsh

0 commit comments

Comments
 (0)