debug(ci): instrument pack-upload step with full trace log
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -292,24 +292,49 @@ jobs:
|
||||
if ($code -ne 0) { exit $code }
|
||||
|
||||
- name: Pack + upload publish.tar.gz
|
||||
if: always() # debug: force-run even if previous step is marked failed
|
||||
if: always() # debug
|
||||
shell: powershell
|
||||
env:
|
||||
REG_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REG_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$log = 'pack-upload.log'
|
||||
"started at $(Get-Date)" | Out-File $log -Encoding ASCII
|
||||
try {
|
||||
$tag = "${{ github.ref_name }}"
|
||||
if ($tag -notmatch '^v(\d+\.\d+\.\d+)$') { throw "tag $tag not in vMAJOR.MINOR.PATCH" }
|
||||
"tag='$tag'" | Out-File -Append $log
|
||||
if ($tag -notmatch '^v(\d+\.\d+\.\d+)$') {
|
||||
"tag $tag not in vMAJOR.MINOR.PATCH form" | Out-File -Append $log
|
||||
throw "tag $tag not in vMAJOR.MINOR.PATCH"
|
||||
}
|
||||
$versionDot = $Matches[1]
|
||||
"versionDot=$versionDot" | Out-File -Append $log
|
||||
|
||||
& tar -czf publish.tar.gz publish
|
||||
# List publish dir before tar
|
||||
"publish dir contents:" | Out-File -Append $log
|
||||
Get-ChildItem -Recurse publish -ErrorAction SilentlyContinue | Select-Object FullName | Out-File -Append $log
|
||||
|
||||
& tar -czf publish.tar.gz publish 2>&1 | ForEach-Object { $_.ToString() } | Out-File -Append $log
|
||||
"tar exit: $LASTEXITCODE" | Out-File -Append $log
|
||||
if ($LASTEXITCODE -ne 0) { throw "tar failed with $LASTEXITCODE" }
|
||||
|
||||
$size = (Get-Item publish.tar.gz).Length
|
||||
"tar.gz size: $size" | Out-File -Append $log
|
||||
|
||||
$pair = "$($env:REG_USER):$($env:REG_PASS)"
|
||||
$auth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
|
||||
$uri = "https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish/$versionDot/publish.tar.gz"
|
||||
Invoke-WebRequest -Method Put -Uri $uri -Headers @{ Authorization = $auth } -InFile publish.tar.gz -ContentType 'application/gzip' -UseBasicParsing | Out-Null
|
||||
Write-Host "Uploaded $((Get-Item publish.tar.gz).Length) bytes to $uri"
|
||||
"PUT $uri" | Out-File -Append $log
|
||||
$resp = Invoke-WebRequest -Method Put -Uri $uri -Headers @{ Authorization = $auth } -InFile publish.tar.gz -ContentType 'application/gzip' -UseBasicParsing
|
||||
"PUT response: $($resp.StatusCode)" | Out-File -Append $log
|
||||
"Uploaded $size bytes to $uri" | Out-File -Append $log
|
||||
} catch {
|
||||
"EXCEPTION: $($_.Exception.Message)" | Out-File -Append $log
|
||||
"$($_.ScriptStackTrace)" | Out-File -Append $log
|
||||
}
|
||||
"done at $(Get-Date)" | Out-File -Append $log
|
||||
$global:LASTEXITCODE = 0
|
||||
|
||||
- name: Push publish logs to generic package
|
||||
if: always()
|
||||
@@ -322,7 +347,7 @@ jobs:
|
||||
$pair = "$($env:REG_USER):$($env:REG_PASS)"
|
||||
$auth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
|
||||
$base = "https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish-log/run-$env:RUN_ID"
|
||||
foreach ($f in @('publish.console.log','publish-msbuild.log','publish-finish.log','src/OutlookAddin/OutlookAddin.csproj')) {
|
||||
foreach ($f in @('publish.console.log','publish-msbuild.log','publish-finish.log','pack-upload.log','src/OutlookAddin/OutlookAddin.csproj')) {
|
||||
if (Test-Path $f) {
|
||||
$name = (Split-Path $f -Leaf)
|
||||
Write-Host "PUT $base/$name"
|
||||
|
||||
Reference in New Issue
Block a user