feat: Add build scripts, refactor for binary embedding

This commit is contained in:
Florian Sylvain
2023-08-12 19:42:27 +02:00
parent 047e14df60
commit 7e8b415cab
12 changed files with 98 additions and 17 deletions
+37
View File
@@ -0,0 +1,37 @@
@echo off
setlocal
set "GOARCH=amd64"
set "OUTPUT_DIR=./bin"
set "GO_FILE_PATH=./main/main.go"
set "PROGRAM_NAME=GohCMS"
REM Compile for Windows
set "GOOS=windows"
go build -o "%OUTPUT_DIR%\%PROGRAM_NAME%_windows.exe" "%GO_FILE_PATH%"
if %errorlevel% neq 0 (
echo Compilation for Windows failed.
exit /b %errorlevel%
)
REM Compile for Linux
set "GOOS=linux"
go build -o "%OUTPUT_DIR%\%PROGRAM_NAME%_linux" "%GO_FILE_PATH%"
if %errorlevel% neq 0 (
echo Compilation for Linux failed.
exit /b %errorlevel%
)
REM Compile for macOS
set "GOOS=darwin"
go build -o "%OUTPUT_DIR%\%PROGRAM_NAME%_darwin" "%GO_FILE_PATH%"
if %errorlevel% neq 0 (
echo Compilation for macOS failed.
exit /b %errorlevel%
)
echo Compilation successful for all platforms.
endlocal