-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.cmd
More file actions
48 lines (38 loc) · 772 Bytes
/
Copy pathbuild.cmd
File metadata and controls
48 lines (38 loc) · 772 Bytes
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
@echo off
setlocal
set bin=bin
set option=%1
set tag=%2
for %%* in (.) do set appName=%%~nx*
rd %bin% /q/s 2>nul
md %bin%
if /i "%tag%"=="" (
echo No Tag supplied
set tag=dev
) else (
pushd cmd
echo package cmd > ver.go
echo. >> ver.go
echo const _VERSION = "%tag%" >> ver.go
git add ver.go
git commit -m "Running release for %tag%"
git tag %tag%
popd
)
go test ./...
call :THE_BUILD windows
if /i "%option%"=="release" (
call :THE_BUILD linux
call :THE_BUILD darwin
)
exit /b 0
:THE_BUILD
setlocal
echo Building :%TIME%
set GOOS=%1
if /i "%GOOS%"=="windows" set ext=.exe
set file=%bin%/%appName%-%tag%-%GOOS%%ext%
del %file% 2>nul
go build -o %file%
echo Done :%TIME%
goto :EOF