mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
Don't embed git commit sha in version command output
This commit is contained in:
7
Makefile
7
Makefile
@@ -1,6 +1,5 @@
|
|||||||
NAME=asciinema
|
NAME=asciinema
|
||||||
VERSION=$(shell grep 'const Version' main.go | awk -F '"' '{print $$2}')
|
VERSION=$(shell grep 'const Version' main.go | awk -F '"' '{print $$2}')
|
||||||
COMMIT=$(shell git rev-parse --short HEAD)
|
|
||||||
|
|
||||||
DIRS=bin
|
DIRS=bin
|
||||||
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
|
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
|
||||||
@@ -15,7 +14,7 @@ DOC_DIR=$(PREFIX)/share/doc/$(NAME)
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: test
|
build: test
|
||||||
go build -o bin/asciinema -ldflags "-X main.GitCommit $(COMMIT)"
|
go build -o bin/asciinema
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test ./...
|
go test ./...
|
||||||
@@ -29,7 +28,7 @@ fmtdiff:
|
|||||||
travis: build fmtdiff
|
travis: build fmtdiff
|
||||||
|
|
||||||
gox:
|
gox:
|
||||||
gox -os="darwin freebsd linux" -arch="386 amd64" -output="bin/asciinema_{{.OS}}_{{.Arch}}" -ldflags "-X main.GitCommit $(COMMIT)"
|
gox -os="darwin freebsd linux" -arch="386 amd64" -output="bin/asciinema_{{.OS}}_{{.Arch}}"
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
git tag | grep "v$(VERSION)" && echo "Tag v$(VERSION) exists" && exit 1 || true
|
git tag | grep "v$(VERSION)" && echo "Tag v$(VERSION) exists" && exit 1 || true
|
||||||
@@ -65,6 +64,6 @@ RELEASE=asciinema-$(VERSION)-$(GOOS)-$(GOARCH)
|
|||||||
|
|
||||||
os-arch-tgz:
|
os-arch-tgz:
|
||||||
mkdir -p dist/$(VERSION)/$(RELEASE)
|
mkdir -p dist/$(VERSION)/$(RELEASE)
|
||||||
go build -o dist/$(VERSION)/$(RELEASE)/asciinema -ldflags "-X main.GitCommit $(COMMIT)"
|
go build -o dist/$(VERSION)/$(RELEASE)/asciinema
|
||||||
cp README.md CHANGELOG.md LICENSE dist/$(VERSION)/$(RELEASE)
|
cp README.md CHANGELOG.md LICENSE dist/$(VERSION)/$(RELEASE)
|
||||||
cd dist/$(VERSION) && tar czf $(RELEASE).tar.gz $(RELEASE)
|
cd dist/$(VERSION) && tar czf $(RELEASE).tar.gz $(RELEASE)
|
||||||
|
|||||||
10
main.go
10
main.go
@@ -14,8 +14,6 @@ import (
|
|||||||
|
|
||||||
const Version = "1.1.1"
|
const Version = "1.1.1"
|
||||||
|
|
||||||
var GitCommit string // initialized during build
|
|
||||||
|
|
||||||
var usage = `Record and share your terminal sessions, the right way.
|
var usage = `Record and share your terminal sessions, the right way.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
@@ -79,13 +77,7 @@ func uintArg(args map[string]interface{}, name string, defaultValue uint) uint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func formatVersion() string {
|
func formatVersion() string {
|
||||||
var commitInfo string
|
return fmt.Sprintf("asciinema %v", Version)
|
||||||
|
|
||||||
if GitCommit != "" {
|
|
||||||
commitInfo = "-" + GitCommit
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("asciinema %v%v\n", Version, commitInfo)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func environment() map[string]string {
|
func environment() map[string]string {
|
||||||
|
|||||||
Reference in New Issue
Block a user