Skip to content

Commit 3b89aae

Browse files
committed
chore/Add commit to text
1 parent 2e24436 commit 3b89aae

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/continuous-build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,28 @@ jobs:
3333
Remove-Item -Recurse -Force Publish, Pure3DDataViewer.zip -ErrorAction Ignore
3434
New-Item -ItemType Directory -Force Publish\Plugins | Out-Null
3535
36+
- name: Inject commit hash into FrmMain.cs
37+
run: |
38+
$file = "Pure3DDataViewer/Pure3DDataViewer/FrmMain.cs"
39+
$commit = "${{ github.sha }}".Substring(0,7)
40+
41+
$content = Get-Content $file -Raw
42+
43+
$pattern = '\{Text\}\s+v\{version\}'
44+
$replacement = "{Text} v{version}-$commit"
45+
46+
$newContent = [regex]::Replace($content, $pattern, $replacement)
47+
48+
if ($content -eq $newContent) {
49+
Write-Host "Pattern did not match. Dumping nearby lines for debugging:"
50+
Get-Content $file | Select-String "_Text"
51+
exit 1
52+
} else {
53+
Write-Host "Commit hash injected: -$commit"
54+
}
55+
56+
Set-Content $file $newContent
57+
3658
- name: Publish main app
3759
run: |
3860
dotnet publish Pure3DDataViewer/Pure3DDataViewer/Pure3DDataViewer.csproj -c Release -r win-x64 -p:PublishSingleFile=true --self-contained false -o Pure3DDataViewer/Pure3DDataViewer/bin/publish

0 commit comments

Comments
 (0)