2026-05-15 20:16:14 -04:00
# Build + test verification, then push the current branch to origin.
2026-05-10 09:42:29 -04:00
#
# Run from the repo root:
# pwsh -ExecutionPolicy Bypass -File .\commit-and-push.ps1
#
2026-05-15 20:16:14 -04:00
# This is the operator's "I'm done with this branch, ship it" helper. It
# runs build-and-test.ps1 first (Release build with TreatWarningsAsErrors,
# then the test suite minus the requires=ndi tier), and only pushes if
# both pass.
#
# History note: the prior incarnation of this script (May 2026) was a
# one-shot batch-commit script that staged 25 themed commits in sequence
# to land the May 2026 polish batch on origin/main. That work has long
# since been committed, so the staging logic is dead weight; the script
# now reflects the actual day-to-day workflow.
2026-05-10 09:42:29 -04:00
$ErrorActionPreference = 'Stop'
if ( -not ( Test-Path '.git' ) -or -not ( Test-Path 'TeamsISO.sln' ) ) {
throw " Run from the TeamsISO repo root. "
}
2026-05-15 20:16:14 -04:00
# Step 1 — build + tests must be green before anything ships.
Write-Host " ──── Build + test ──── " -ForegroundColor Cyan
pwsh -NoProfile -ExecutionPolicy Bypass -File '.\build-and-test.ps1'
if ( $LASTEXITCODE -ne 0 ) { throw " build-and-test.ps1 failed; aborting. " }
2026-05-10 09:42:29 -04:00
2026-05-15 20:16:14 -04:00
# Step 2 — what are we pushing? Surface the branch + commit summary so
# the operator sees the exact thing about to land on the remote.
$branch = ( git rev-parse - -abbrev -ref HEAD ) . Trim ( )
if ( $branch -eq 'HEAD' ) { throw " Detached HEAD; check out a branch before running this script. " }
2026-05-10 09:42:29 -04:00
Write-Host " "
2026-05-15 20:16:14 -04:00
Write-Host " ──── Pushing $branch to origin ──── " -ForegroundColor Cyan
git status - -short
$ahead = ( git rev-list - -count " origin/ $branch ..HEAD " 2 > $null )
if ( -not $ahead ) { $ahead = ( git rev-list - -count HEAD ) . Trim ( ) }
Write-Host " $ahead commit(s) to push. " -ForegroundColor DarkGray
git push origin $branch
if ( $LASTEXITCODE -ne 0 ) { throw " git push failed. " }
2026-05-10 09:42:29 -04:00
Write-Host " "
2026-05-15 20:16:14 -04:00
Write-Host " Done. Pushed $branch to origin. " -ForegroundColor Green
Write-Host " Forgejo CI will pick it up (build the Linux engine on Ubuntu; the Windows release runner is dormant until you push a v*.*.* tag). " -ForegroundColor DarkGray