-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.ps1
More file actions
57 lines (42 loc) · 1.36 KB
/
update.ps1
File metadata and controls
57 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<#
.SYNOPSIS
Update script for EnumerablePrinter.
.DESCRIPTION
Runs build and test checks, commits changes, rebases, and pushes to main.
Does NOT bump version, tag, or deploy. Version changes occur ONLY during deploy.
.EXAMPLE
.\update.ps1 -Message "Fix README.md"
.PARAMETER Message
Commit message to use.
#>
param (
[string]$Message = "Update EnumerablePrinter"
)
function Write-Log($msg) {
$ts = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "$ts - $msg"
}
function Invoke-Checks {
Write-Log "🔍 Running build and test checks..."
dotnet build --nologo --verbosity quiet
if ($LASTEXITCODE -ne 0) { throw "❌ Build failed." }
dotnet test --no-build --nologo --verbosity quiet
if ($LASTEXITCODE -ne 0) { throw "❌ Tests failed." }
Write-Log "✅ Checks passed."
}
# Run checks
Invoke-Checks
Write-Log "📦 Staging changes..."
git add .
Write-Log "📝 Committing: '$Message'"
git commit -m "$Message"
# Handle rebase if needed
if (Test-Path ".git\rebase-merge") {
Write-Log "🔄 Rebase in progress. Attempting to continue..."
git rebase --continue
}
Write-Log "🔄 Rebasing from origin/main..."
git pull --rebase origin main
Write-Log "🚀 Pushing to origin/main..."
git push origin main
Write-Log "✅ Update complete (no version bump, no tag, no deploy)."