gin-standard/Makefile

23 lines
977 B
Makefile
Raw Permalink Normal View History

2021-09-03 15:15:39 +00:00
appname = gin-standard
serverip = 8.8.8.8
serverport = 22
apppath = /usr/local/gin
.PHONY : linux
linux:
go mod tidy
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(appname) .
.PHONY : windows
windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-s -w --extldflags "-static -fpic"' -o $(appname).exe .
.PHONY : release
release: linux
ssh -p $(serverport) ubuntu@$(serverip) "sudo systemctl stop iap.service"
ssh -p $(serverport) ubuntu@$(serverip) "if [ ! -d $(apppath)/bak ]; then mkdir -p $(apppath)/bak; fi"
ssh -p $(serverport) ubuntu@$(serverip) "if [ -f $(apppath)/$(appname) ]; then cp $(apppath)/$(appname) $(apppath)/bak; fi"
ssh -p $(serverport) ubuntu@$(serverip) "if [ ! -d $(apppath)/docs ]; then mkdir -p $(apppath)/docs; fi"
scp -P $(serverport) ./docs/* ubuntu@$(serverip):$(apppath)/docs/
scp -P $(serverport) ./$(appname) ubuntu@$(serverip):$(apppath)
ssh -p $(serverport) ubuntu@$(serverip) "sudo systemctl start iap.service"