mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
add version files
This commit is contained in:
parent
59d68e7f0d
commit
f7c952f8ca
15
Makefile
15
Makefile
|
@ -21,16 +21,16 @@ $(BIN_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
bbgo-linux: $(BIN_DIR)
|
bbgo-linux: $(BIN_DIR)
|
||||||
GOOS=linux GOARCH=$(TARGET_ARCH) go build -tags web -o $(BIN_DIR)/$@ ./cmd/bbgo
|
GOOS=linux GOARCH=$(TARGET_ARCH) go build -tags web,release -o $(BIN_DIR)/$@ ./cmd/bbgo
|
||||||
|
|
||||||
bbgo-darwin: $(BIN_DIR)
|
bbgo-darwin: $(BIN_DIR)
|
||||||
GOOS=darwin GOARCH=$(TARGET_ARCH) go build -tags web -o $(BIN_DIR)/$@ ./cmd/bbgo
|
GOOS=darwin GOARCH=$(TARGET_ARCH) go build -tags web,release -o $(BIN_DIR)/$@ ./cmd/bbgo
|
||||||
|
|
||||||
bbgo-darwin-slim: $(BIN_DIR)
|
bbgo-darwin-slim: $(BIN_DIR)
|
||||||
GOOS=darwin GOARCH=$(TARGET_ARCH) go build -o $(BIN_DIR)/$@ ./cmd/bbgo
|
GOOS=darwin GOARCH=$(TARGET_ARCH) go build -tags release -o $(BIN_DIR)/$@ ./cmd/bbgo
|
||||||
|
|
||||||
bbgo-linux-slim: $(BIN_DIR)
|
bbgo-linux-slim: $(BIN_DIR)
|
||||||
GOOS=linux GOARCH=$(TARGET_ARCH) go build -o $(BIN_DIR)/$@ ./cmd/bbgo
|
GOOS=linux GOARCH=$(TARGET_ARCH) go build -tags release -o $(BIN_DIR)/$@ ./cmd/bbgo
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD_DIR) $(DIST_DIR) $(FRONTEND_EXPORT_DIR)
|
rm -rf $(BUILD_DIR) $(DIST_DIR) $(FRONTEND_EXPORT_DIR)
|
||||||
|
@ -63,6 +63,11 @@ dist: static bbgo-linux bbgo-linux-slim bbgo-darwin bbgo-darwin-slim desktop
|
||||||
mkdir -p $(DIST_DIR)
|
mkdir -p $(DIST_DIR)
|
||||||
tar -C $(BUILD_DIR) -cvzf $(DIST_DIR)/bbgo-$$(git describe --tags).tar.gz .
|
tar -C $(BUILD_DIR) -cvzf $(DIST_DIR)/bbgo-$$(git describe --tags).tar.gz .
|
||||||
|
|
||||||
|
pkg/version/version.go: .git/HEAD
|
||||||
|
bash utils/generate-version-file.sh > $@
|
||||||
|
|
||||||
|
version: pkg/version/version.go
|
||||||
|
|
||||||
migrations:
|
migrations:
|
||||||
rockhopper compile --config rockhopper_mysql.yaml --output pkg/migrations/mysql
|
rockhopper compile --config rockhopper_mysql.yaml --output pkg/migrations/mysql
|
||||||
rockhopper compile --config rockhopper_sqlite.yaml --output pkg/migrations/sqlite3
|
rockhopper compile --config rockhopper_sqlite.yaml --output pkg/migrations/sqlite3
|
||||||
|
@ -87,4 +92,4 @@ embed: pkg/server/assets.go
|
||||||
|
|
||||||
static: frontend/out/index.html pkg/server/assets.go
|
static: frontend/out/index.html pkg/server/assets.go
|
||||||
|
|
||||||
.PHONY: bbgo dist migrations static embed desktop .FORCE
|
.PHONY: bbgo version dist migrations static embed desktop .FORCE
|
||||||
|
|
|
@ -22,15 +22,16 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/util"
|
"github.com/c9s/bbgo/pkg/util"
|
||||||
|
"github.com/c9s/bbgo/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ProductionAPIURL is the official MAX API v2 Endpoint
|
// ProductionAPIURL is the official MAX API v2 Endpoint
|
||||||
ProductionAPIURL = "https://max-api.maicoin.com/api/v2"
|
ProductionAPIURL = "https://max-api.maicoin.com/api/v2"
|
||||||
|
|
||||||
UserAgent = "bbgo/1.0"
|
UserAgent = "bbgo/" + version.Version
|
||||||
|
|
||||||
defaultHTTPTimeout = time.Second * 15
|
defaultHTTPTimeout = time.Second * 30
|
||||||
)
|
)
|
||||||
|
|
||||||
var logger = log.WithField("exchange", "max")
|
var logger = log.WithField("exchange", "max")
|
||||||
|
|
5
pkg/version/dev.go
Normal file
5
pkg/version/dev.go
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// +build !release
|
||||||
|
|
||||||
|
package version
|
||||||
|
|
||||||
|
const Version = "1.x-dev"
|
6
pkg/version/version.go
Normal file
6
pkg/version/version.go
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
// +build release
|
||||||
|
|
||||||
|
package version
|
||||||
|
|
||||||
|
const Version = "v1.11.1-32-g1e205b1"
|
||||||
|
|
13
utils/generate-version-file.sh
Normal file
13
utils/generate-version-file.sh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
packageName=version
|
||||||
|
version=$(git describe --tags)
|
||||||
|
|
||||||
|
cat <<END
|
||||||
|
// +build release
|
||||||
|
|
||||||
|
package $packageName
|
||||||
|
|
||||||
|
const Version = "${version}"
|
||||||
|
|
||||||
|
END
|
Loading…
Reference in New Issue
Block a user