pull/5/head
Evan Chen 2021-10-16 02:09:42 +08:00
parent e47242cfb8
commit 5f99ca837d
3 changed files with 15 additions and 6 deletions

6
CHANGELOG.md Normal file
View File

@ -0,0 +1,6 @@
# 0.1.2
## Fix
* refactor: use cobra and pflag
* client mode unreachable in docker

View File

@ -22,10 +22,13 @@ build:
build-bins:
$(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), \
$(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_$(GOOS)_$(GOARCH))))
$(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_$(GOOS)_$(GOARCH)/$(PROJ))))
build-m1:
$(shell export GOOS=darwin; export GOARCH=arm64; go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_darwin_arm64)
$(shell export GOOS=darwin; export GOARCH=arm64; go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_darwin_arm64/$(PROJ))
build-zip:
cd dist; for f in * ;do tar -czf $${f}.tar.gz $${f}; done
docker:
docker build --target builder -t $(HUB)/$(HUB_PROJECT)/$(PROJ):builder .
@ -39,9 +42,9 @@ docker-push:
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
docker-save:
docker save -o dist/$(PROJ)-$(VERSION)-${BUILD}.tar $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION)
docker save $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) | gzip > dist/$(PROJ)-image-$(VERSION)-${BUILD}.tar.gz
release: build-bins build-m1 docker docker-save docker-push
release: clean build-bins build-m1 build-zip docker docker-save docker-push
.PHONY: build docker release clean all

View File

@ -17,14 +17,14 @@ var versionCmd = &cobra.Command{
Short: "version",
Long: `Print the version number of myip`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(Version + Build)
fmt.Println(Version + "-" + Build)
},
}
func init() {
log.SetFlags(0)
log.SetOutput(os.Stdout)
cmd.ClientCmd.Version = Version
cmd.ClientCmd.Version = Version + "-" + Build
cmd.ClientCmd.AddCommand(versionCmd)
cmd.ClientCmd.AddCommand(cmd.ServerCmd)
}