# Step 3, on Windows: push the image step 2 built, : and :latest, # with wslc. Never rebuilds: after a failed push, fix the login and run it again. $ErrorActionPreference = 'Stop' . "$PSScriptRoot\_common.ps1" Assert-Wslc $sha = Get-ReleaseSha wslc image inspect "${Image}:$sha" | Out-Null if ($LASTEXITCODE -ne 0) { throw "no local ${Image}:$sha - run step 2 first" } # latest must name this candidate, even if another image was built since. wslc tag "${Image}:$sha" "${Image}:latest" if ($LASTEXITCODE -ne 0) { throw "wslc tag failed (exit $LASTEXITCODE)" } foreach ($tag in $sha, 'latest') { Write-Host "== push ${Image}:$tag" -ForegroundColor Cyan wslc push "${Image}:$tag" if ($LASTEXITCODE -ne 0) { Write-Host "If the push was refused: wslc login $(($Image -split '/')[0]) -u , with a token that has package-write access" -ForegroundColor Yellow throw "wslc push ${Image}:$tag failed (exit $LASTEXITCODE)" } } Write-Host "Published ${Image}:$sha and ${Image}:latest"