mirror of
https://github.com/thegeeklab/github-releases-notifier.git
synced 2024-11-23 05:10:38 +00:00
fix versioning
This commit is contained in:
parent
aac1f82c3d
commit
850dadecad
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,14 +1,4 @@
|
|||||||
/.env
|
/release/
|
||||||
/github-releases-notifier
|
/github-releases-notifier*
|
||||||
|
|
||||||
# Binaries for programs and plugins
|
coverage.out
|
||||||
*.exe
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Test binary, build with `go test -c`
|
|
||||||
*.test
|
|
||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
|
||||||
*.out
|
|
||||||
|
73
Makefile
73
Makefile
@ -1,73 +0,0 @@
|
|||||||
DIST := dist
|
|
||||||
BIN := bin
|
|
||||||
|
|
||||||
EXECUTABLE := github-releases-notifier
|
|
||||||
|
|
||||||
PWD := $(shell pwd)
|
|
||||||
VERSION := $(shell cat VERSION)
|
|
||||||
SHA := $(shell cat COMMIT 2>/dev/null || git rev-parse --short=8 HEAD)
|
|
||||||
DATE := $(shell date -u '+%FT%T%z')
|
|
||||||
|
|
||||||
GOLDFLAGS += -X "main.version=$(VERSION)"
|
|
||||||
GOLDFLAGS += -X "main.date=$(DATE)"
|
|
||||||
GOLDFLAGS += -X "main.commit=$(SHA)"
|
|
||||||
GOLDFLAGS += -extldflags '-static'
|
|
||||||
|
|
||||||
GO := CGO_ENABLED=0 go
|
|
||||||
|
|
||||||
GOOS ?= $(shell go version | cut -d' ' -f4 | cut -d'/' -f1)
|
|
||||||
GOARCH ?= $(shell go version | cut -d' ' -f4 | cut -d'/' -f2)
|
|
||||||
|
|
||||||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/ | grep -v /tests)
|
|
||||||
|
|
||||||
TAGS ?= netgo
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: clean test build
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
$(GO) clean -i ./...
|
|
||||||
find . -type f -name "coverage.out" -delete
|
|
||||||
|
|
||||||
.PHONY: fmt
|
|
||||||
fmt:
|
|
||||||
$(GO) fmt $(PACKAGES)
|
|
||||||
|
|
||||||
.PHONY: tests
|
|
||||||
tests: test vet lint errcheck megacheck
|
|
||||||
|
|
||||||
.PHONY: vet
|
|
||||||
vet:
|
|
||||||
$(GO) vet $(PACKAGES)
|
|
||||||
|
|
||||||
.PHONY: lint
|
|
||||||
lint:
|
|
||||||
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) get -u github.com/golang/lint/golint; \
|
|
||||||
fi
|
|
||||||
STATUS=0; for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || STATUS=1; done; exit $$STATUS
|
|
||||||
|
|
||||||
.PHONY: errcheck
|
|
||||||
errcheck:
|
|
||||||
@which errcheck > /dev/null; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) get -u github.com/kisielk/errcheck; \
|
|
||||||
fi
|
|
||||||
STATUS=0; for PKG in $(PACKAGES); do errcheck $$PKG || STATUS=1; done; exit $$STATUS
|
|
||||||
|
|
||||||
.PHONY: megacheck
|
|
||||||
megacheck:
|
|
||||||
@which megacheck > /dev/null; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) get -u honnef.co/go/tools/cmd/megacheck; \
|
|
||||||
fi
|
|
||||||
STATUS=0; for PKG in $(PACKAGES); do megacheck $$PKG || STATUS=1; done; exit $$STATUS
|
|
||||||
|
|
||||||
.PHONY: test
|
|
||||||
test:
|
|
||||||
STATUS=0; for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || STATUS=1; done; exit $$STATUS
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build: $(EXECUTABLE)-$(GOOS)-$(GOARCH)
|
|
||||||
|
|
||||||
$(EXECUTABLE)-$(GOOS)-$(GOARCH): $(wildcard *.go)
|
|
||||||
$(GO) build -tags '$(TAGS)' -ldflags '-s -w $(GOLDFLAGS)' -o $(EXECUTABLE)
|
|
@ -17,7 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Version of current build
|
// Version of current build
|
||||||
var Version = "devel"
|
var version = "unknown"
|
||||||
|
|
||||||
// Config of env and args
|
// Config of env and args
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -36,7 +36,7 @@ func (c Config) Token() *oauth2.Token {
|
|||||||
|
|
||||||
// Version prints version string
|
// Version prints version string
|
||||||
func (Config) Version() string {
|
func (Config) Version() string {
|
||||||
return "github-releases-notifier " + Version
|
return "github-releases-notifier " + version
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user