From 00c679a3f04df5378d46fb57b9abbdd374c93680 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 8 Aug 2018 22:40:01 +1000 Subject: [PATCH 1/3] swap travis for goreleaser --- .goreleaser.yml | 22 ++++++++++++++++++++++ .travis.yml | 39 --------------------------------------- 2 files changed, 22 insertions(+), 39 deletions(-) create mode 100644 .goreleaser.yml delete mode 100644 .travis.yml diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..41c2806ed --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,22 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +builds: +- env: + - CGO_ENABLED=0 +archive: + replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6148884d3..000000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: go -sudo: false -env: - - DEP_VERSION="0.5.0" -matrix: - include: - - go: 1.x - env: LATEST=true - - go: tip - allow_failures: - - go: tip -before_install: - # Download the binary to bin folder in $GOPATH - # - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-386 -o $GOPATH/bin/dep - - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - # Make the binary executable - - chmod +x $GOPATH/bin/dep - - ls $GOPATH/bin/ - - dep ensure - - go get github.com/mitchellh/gox -install: - - -script: -# - go get -v ./... -# - diff -u <(echo -n) <(gofmt -d .) # can't make gofmt ignore vendor directory -# - go vet $(go list ./... | grep -v /vendor/) - - if [ "${LATEST}" = "true" ]; then gox -ldflags "-X main.Rev=`git rev-parse --short HEAD` -X main.builddate=`date -u +%Y%m%d.%H%M%S` -X main.Version=${TRAVIS_TAG}" -verbose ./...; fi -deploy: - provider: releases - skip_cleanup: true - api_key: - secure: TnB8I+swjicHuGTXk3ncm1Aaa12eIJqWV/Lhcnbb01i39p6+fyn3vDMdWPcejt3R8gcJqv4wyP8UQVO9G1qkLppt6V/qAuY5x6nX0MgEa3t+8JLJnGYHZYsuIgan/ecAmeu5+6dgUhr9Oq6zQOEv/O88NsALzMlqnEQNXI8XSoScfhkiVDIp3zWov0vBizCdThnNgTx9zRpJVoqxmhWvgt+me2+fOhSx1Y+3ZA2gE7zq8IFAbxp36d0rsR5lKqmTuF+YsF9iQ7Ar+xCjbRunLsZx+VwGqGfpS/qS7EwsEqBI0vEO76eFJkwEsIzOvJiFNhBDUu3upquBFMT4uzxRxH3eV+J4mZtu29UDLdvKI5Q730Lk9AgmH4now+RmP08M0SEXJa+AnHeuBv2u1iU5bu+sI6CORVQzKQwOph9AABDjSZ54wrXIpYEeIW2sz8nx+hiG6QL1mqfM/l+55BR69u3vxKYMryQBxPuzhZCTOqqI4uahlb6GIUNZJ9vGZeIA9HFJq3ymW8cdrpYzhKf3Nx9jK+Yb81h5/AHq9iChXEC63VPCDXXGRllh2UYWNYCaAdtk+ekpLR8299e4CaEregy6g5U2S3/xrBKl87miu1uJ/fquXoxGdSU+JcmsmXZ26sGIU2TCYdNjSfIgpOyfMmB4JNtKHqWRHA9Fe42CRpA= - file_glob: true - file: - - lazygit_* - on: - repo: jesseduffield/lazygit - tags: true - condition: $LATEST = true From 778cb14dc48d24764b86d2a7e9ac3a7ddb4121a6 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 8 Aug 2018 22:48:37 +1000 Subject: [PATCH 2/3] update to use goreleaser ldflags --- .goreleaser.yml | 14 ++++++++++++-- main.go | 11 ++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 41c2806ed..27aaf3638 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,8 +1,18 @@ # This is an example goreleaser.yaml file with some sane defaults. # Make sure to check the documentation at http://goreleaser.com builds: -- env: - - CGO_ENABLED=0 + env: + - CGO_ENABLED=0 + main: ./main.go + goos: + - freebsd + - windows + - darwin + - linux + goarch: + - amd64 + - arm + - arm64 archive: replacements: darwin: Darwin diff --git a/main.go b/main.go index ad753c407..dcffbd835 100644 --- a/main.go +++ b/main.go @@ -20,13 +20,10 @@ var ( subprocess *exec.Cmd startTime time.Time - // Rev - Git Revision - Rev string + commit string + version = "unversioned" - // Version - Version number - Version = "unversioned" - - builddate string + date string debuggingFlag = flag.Bool("debug", false, "a boolean") versionFlag = flag.Bool("v", false, "Print the current version") ) @@ -77,7 +74,7 @@ func main() { devLog("\n\n\n\n\n\n\n\n\n\n") flag.Parse() if *versionFlag { - fmt.Printf("rev=%s, build date=%s, version=%s", Rev, builddate, Version) + fmt.Printf("rev=%s, build date=%s, version=%s", Rev, date, Version) os.Exit(0) } verifyInGitRepo() From 7f75808499f466bad8bb4ed0000edd9f7b926079 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 8 Aug 2018 22:51:18 +1000 Subject: [PATCH 3/3] cleanup for goreleaser --- .goreleaser.yml | 2 ++ github_token | 1 + gui.go | 6 +++--- main.go | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 github_token diff --git a/.goreleaser.yml b/.goreleaser.yml index 27aaf3638..3184ff484 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -30,3 +30,5 @@ changelog: exclude: - '^docs:' - '^test:' +env_files: + github_token: ./github_token diff --git a/github_token b/github_token new file mode 100644 index 000000000..ad2b69c96 --- /dev/null +++ b/github_token @@ -0,0 +1 @@ +TnB8I+swjicHuGTXk3ncm1Aaa12eIJqWV/Lhcnbb01i39p6+fyn3vDMdWPcejt3R8gcJqv4wyP8UQVO9G1qkLppt6V/qAuY5x6nX0MgEa3t+8JLJnGYHZYsuIgan/ecAmeu5+6dgUhr9Oq6zQOEv/O88NsALzMlqnEQNXI8XSoScfhkiVDIp3zWov0vBizCdThnNgTx9zRpJVoqxmhWvgt+me2+fOhSx1Y+3ZA2gE7zq8IFAbxp36d0rsR5lKqmTuF+YsF9iQ7Ar+xCjbRunLsZx+VwGqGfpS/qS7EwsEqBI0vEO76eFJkwEsIzOvJiFNhBDUu3upquBFMT4uzxRxH3eV+J4mZtu29UDLdvKI5Q730Lk9AgmH4now+RmP08M0SEXJa+AnHeuBv2u1iU5bu+sI6CORVQzKQwOph9AABDjSZ54wrXIpYEeIW2sz8nx+hiG6QL1mqfM/l+55BR69u3vxKYMryQBxPuzhZCTOqqI4uahlb6GIUNZJ9vGZeIA9HFJq3ymW8cdrpYzhKf3Nx9jK+Yb81h5/AHq9iChXEC63VPCDXXGRllh2UYWNYCaAdtk+ekpLR8299e4CaEregy6g5U2S3/xrBKl87miu1uJ/fquXoxGdSU+JcmsmXZ26sGIU2TCYdNjSfIgpOyfMmB4JNtKHqWRHA9Fe42CRpA= diff --git a/gui.go b/gui.go index 5ae6ab134..b69cc24d8 100644 --- a/gui.go +++ b/gui.go @@ -161,7 +161,7 @@ func layout(g *gocui.Gui) error { v.FgColor = gocui.ColorWhite } - if v, err := g.SetView("options", -1, optionsTop, width-len(Version)-2, optionsTop+2, 0); err != nil { + if v, err := g.SetView("options", -1, optionsTop, width-len(version)-2, optionsTop+2, 0); err != nil { if err != gocui.ErrUnknownView { return err } @@ -170,14 +170,14 @@ func layout(g *gocui.Gui) error { v.Frame = false } - if v, err := g.SetView("version", width-len(Version)-1, optionsTop, width, optionsTop+2, 0); err != nil { + if v, err := g.SetView("version", width-len(version)-1, optionsTop, width, optionsTop+2, 0); err != nil { if err != gocui.ErrUnknownView { return err } v.BgColor = gocui.ColorDefault v.FgColor = gocui.ColorGreen v.Frame = false - renderString(g, "version", Version) + renderString(g, "version", version) // these are only called once handleFileSelect(g, filesView) diff --git a/main.go b/main.go index dcffbd835..93be5824e 100644 --- a/main.go +++ b/main.go @@ -74,7 +74,7 @@ func main() { devLog("\n\n\n\n\n\n\n\n\n\n") flag.Parse() if *versionFlag { - fmt.Printf("rev=%s, build date=%s, version=%s", Rev, date, Version) + fmt.Printf("commit=%s, build date=%s, version=%s", commit, date, version) os.Exit(0) } verifyInGitRepo()