-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmake.bat
40 lines (28 loc) · 1014 Bytes
/
make.bat
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
@echo off
SETLOCAL
set APP=Citrix-NetScaler-Exporter
set VERSION=4.6.0
set BINARY-WINDOWS-X64=%APP%_%VERSION%_Windows_amd64.exe
set BINARY-LINUX=%APP%_%VERSION%_Linux_amd64
REM Set build number from git commit hash
for /f %%i in ('git rev-parse HEAD') do set BUILD=%%i
set LDFLAGS=-ldflags "-X main.version=%VERSION% -X main.build=%BUILD% -s -w -extldflags '-static'"
goto build
:build
echo "=== Building docker image ==="
rem docker build -t rokett/citrix-netscaler-exporter:latest -t rokett/citrix-netscaler-exporter:v%VERSION% .
rem docker push rokett/citrix-netscaler-exporter:v%VERSION%
rem docker push rokett/citrix-netscaler-exporter:latest
echo "=== Building Windows x64 ==="
set GOOS=windows
set GOARCH=amd64
go build -mod=vendor %LDFLAGS% -o %BINARY-WINDOWS-X64%
echo "=== Building Linux x64 ==="
set GOOS=linux
set GOARCH=amd64
go build -mod=vendor %LDFLAGS% -o %BINARY-LINUX%
goto clean
:clean
set GOOS=
set GOARCH=
goto :EOF