-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
41 lines (31 loc) · 971 Bytes
/
Makefile
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
# load env file
ifeq ($(shell test -e .env && echo -n yes),yes)
include .env
export $(shell sed 's/[\#=].*//' .env)
endif
# generate build version info
VERSION:=$(shell git describe --dirty --always)
#VERSION := $(shell git describe --tags)
BUILD := $(shell git rev-parse HEAD)
REPO := github.com/airdb/sls-bbhj
LDFLAGS=-ldflags
LDFLAGS += "-X=github.com/airdb/sailor/version.Repo=$(REPO) \
-X=github.com/airdb/sailor/version.Version=$(VERSION) \
-X=github.com/airdb/sailor/version.Build=$(BUILD) \
-X=github.com/airdb/sailor/version.BuildTime=$(shell date +%s)"
default: swag build deploy
build:
GOOS=linux go build $(LDFLAGS) -o main main.go
swag:
swag init --parseDependency --parseInternal --generalInfo main.go
dev: swag
env=dev go run $(LDFLAGS) main.go
deploy:
sls deploy --stage test --profile airdb
release:
sls deploy --stage release --profile airdb
log:
sls logs --tail --stage test
.PHONY:
print-env:
@env