feat(build): add build scripts for Linux and Windows with commit hash and build time

This commit is contained in:
2026-08-07 20:45:05 +08:00
parent fcb0751267
commit d8a192e4e5
5 changed files with 90 additions and 1 deletions
+12
View File
@@ -0,0 +1,12 @@
@echo off
setlocal enabledelayedexpansion
:: Get git commit hash (shortened to 7 characters, can also use full)
for /f %%i in ('git rev-parse --short HEAD') do set COMMIT=%%i
:: Get UTC time
for /f %%i in ('powershell -Command "Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ'"') do set BUILD_DATE=%%i
:: Build -ldflags
set LDFLAGS=-X main.BuildTime=%BUILD_DATE% -X main.CommitHash=%COMMIT%
go run -ldflags "%LDFLAGS%" .