feat(docker): Add build number.
This commit is contained in:
parent
fdc76c4f08
commit
8b5adb6493
12
.drone.yml
12
.drone.yml
@ -10,7 +10,7 @@ clone:
|
||||
|
||||
pipeline:
|
||||
test:
|
||||
image: appleboy/golang-testing
|
||||
image: appleboy/golang-testing:1.9.2
|
||||
pull: true
|
||||
secrets: [ telegram_token, telegram_to ]
|
||||
commands:
|
||||
@ -22,28 +22,28 @@ pipeline:
|
||||
- make coverage
|
||||
|
||||
build_linux_amd64:
|
||||
image: appleboy/golang-testing
|
||||
image: appleboy/golang-testing:1.9.2
|
||||
pull: true
|
||||
group: build
|
||||
commands:
|
||||
- make build_linux_amd64
|
||||
|
||||
build_linux_i386:
|
||||
image: appleboy/golang-testing
|
||||
image: appleboy/golang-testing:1.9.2
|
||||
pull: true
|
||||
group: build
|
||||
commands:
|
||||
- make build_linux_i386
|
||||
|
||||
build_linux_arm64:
|
||||
image: appleboy/golang-testing
|
||||
image: appleboy/golang-testing:1.9.2
|
||||
pull: true
|
||||
group: build
|
||||
commands:
|
||||
- make build_linux_arm64
|
||||
|
||||
build_linux_arm:
|
||||
image: appleboy/golang-testing
|
||||
image: appleboy/golang-testing:1.9.2
|
||||
pull: true
|
||||
group: build
|
||||
commands:
|
||||
@ -58,7 +58,7 @@ pipeline:
|
||||
event: [ push, pull_request ]
|
||||
|
||||
release:
|
||||
image: appleboy/golang-testing
|
||||
image: appleboy/golang-testing:1.9.2
|
||||
pull: true
|
||||
commands:
|
||||
- make release
|
||||
|
2
Makefile
2
Makefile
@ -11,7 +11,7 @@ PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
||||
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
TAGS ?=
|
||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
||||
LDFLAGS ?= -X 'main.Version=$(VERSION)' -X 'main.BuildNum=$(DRONE_BUILD_NUMBER)'
|
||||
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'tempdir')
|
||||
|
||||
ifneq ($(shell uname), Darwin)
|
||||
|
12
main.go
12
main.go
@ -10,14 +10,16 @@ import (
|
||||
)
|
||||
|
||||
// Version set at compile-time
|
||||
var Version string
|
||||
var (
|
||||
Version string
|
||||
BuildNum string
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "telegram plugin"
|
||||
app.Usage = "telegram plugin"
|
||||
app.Action = run
|
||||
app.Version = Version
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "token",
|
||||
@ -185,6 +187,12 @@ func main() {
|
||||
},
|
||||
}
|
||||
|
||||
app.Version = Version
|
||||
|
||||
if BuildNum != "" {
|
||||
app.Version = app.Version + "+" + BuildNum
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user