23 lines
977 B
Makefile
23 lines
977 B
Makefile
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"
|