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:
+37
-12
@@ -292,24 +292,49 @@ jobs:
|
|||||||
if ($code -ne 0) { exit $code }
|
if ($code -ne 0) { exit $code }
|
||||||
|
|
||||||
- name: Pack + upload publish.tar.gz
|
- name: Pack + upload publish.tar.gz
|
||||||
if: always() # debug: force-run even if previous step is marked failed
|
if: always() # debug
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
REG_USER: ${{ secrets.REGISTRY_USER }}
|
REG_USER: ${{ secrets.REGISTRY_USER }}
|
||||||
REG_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
REG_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
run: |
|
run: |
|
||||||
$tag = "${{ github.ref_name }}"
|
$ErrorActionPreference = 'Continue'
|
||||||
if ($tag -notmatch '^v(\d+\.\d+\.\d+)$') { throw "tag $tag not in vMAJOR.MINOR.PATCH" }
|
$log = 'pack-upload.log'
|
||||||
$versionDot = $Matches[1]
|
"started at $(Get-Date)" | Out-File $log -Encoding ASCII
|
||||||
|
try {
|
||||||
|
$tag = "${{ github.ref_name }}"
|
||||||
|
"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
|
||||||
if ($LASTEXITCODE -ne 0) { throw "tar failed with $LASTEXITCODE" }
|
"publish dir contents:" | Out-File -Append $log
|
||||||
|
Get-ChildItem -Recurse publish -ErrorAction SilentlyContinue | Select-Object FullName | Out-File -Append $log
|
||||||
|
|
||||||
$pair = "$($env:REG_USER):$($env:REG_PASS)"
|
& tar -czf publish.tar.gz publish 2>&1 | ForEach-Object { $_.ToString() } | Out-File -Append $log
|
||||||
$auth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
|
"tar exit: $LASTEXITCODE" | Out-File -Append $log
|
||||||
$uri = "https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish/$versionDot/publish.tar.gz"
|
if ($LASTEXITCODE -ne 0) { throw "tar failed with $LASTEXITCODE" }
|
||||||
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"
|
$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"
|
||||||
|
"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
|
- name: Push publish logs to generic package
|
||||||
if: always()
|
if: always()
|
||||||
@@ -322,7 +347,7 @@ jobs:
|
|||||||
$pair = "$($env:REG_USER):$($env:REG_PASS)"
|
$pair = "$($env:REG_USER):$($env:REG_PASS)"
|
||||||
$auth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
|
$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"
|
$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) {
|
if (Test-Path $f) {
|
||||||
$name = (Split-Path $f -Leaf)
|
$name = (Split-Path $f -Leaf)
|
||||||
Write-Host "PUT $base/$name"
|
Write-Host "PUT $base/$name"
|
||||||
|
|||||||
Reference in New Issue
Block a user