From 2042eac58ddbc246f950baa483e835f8a60de3f2 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 19 Feb 2020 14:36:28 +0100 Subject: [PATCH 1/8] Add .goreleaser.yml for brew --- .goreleaser.yml | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .goreleaser.yml diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000000..9e95380bad --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,56 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +# before: +# hooks: +# # you may remove this if you don't use vgo +# - go mod tidy +# # you may remove this if you don't need go generate +# - go generate ./... +# builds: +# - env: +# - CGO_ENABLED=0 +# archives: +# - 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:' +# +brews: + - + # Name template of the recipe + # Default to project name + name: src-cli + + github: + owner: sourcegraph + name: homebrew-src-cli + + # Git author used to commit to the repository. + # Defaults are shown. + commit_author: + name: goreleaserbot + email: goreleaser@carlosbecker.com + + # Folder inside the repository to put the formula. + # Default is the root folder. + folder: Formula + + # Your app's homepage. + # Default is empty. + homepage: "https://sourcegraph.com/" + + # Your app's description. + # Default is empty. + description: "Sourcegraph CLI" From f907940b61d30be8c115c8f0940e48c9dda556e8 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 19 Feb 2020 14:52:02 +0100 Subject: [PATCH 2/8] Run goreleaser on travis --- .goreleaser.yml | 69 +++++++++++++++++-------------------------------- .travis.yml | 14 +++++----- go.sum | 2 -- 3 files changed, 29 insertions(+), 56 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 9e95380bad..75f92863d7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,56 +1,33 @@ -# This is an example goreleaser.yaml file with some sane defaults. -# Make sure to check the documentation at http://goreleaser.com -# before: -# hooks: -# # you may remove this if you don't use vgo -# - go mod tidy -# # you may remove this if you don't need go generate -# - go generate ./... -# builds: -# - env: -# - CGO_ENABLED=0 -# archives: -# - 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:' -# +dist: release +env: + - GO111MODULE=on +before: + hooks: + - go mod download + - go mod tidy +builds: +- + main: ./cmd/src/ + binary: src + ldflags: + - -X main.build={{.Version}} + goos: + - linux + - windows + - darwin + goarch: + - amd64 + env: + - CGO_ENABLED=0 brews: - - # Name template of the recipe - # Default to project name name: src-cli - + homepage: "https://sourcegraph.com/" + description: "Sourcegraph CLI" github: owner: sourcegraph name: homebrew-src-cli - - # Git author used to commit to the repository. - # Defaults are shown. - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - # Folder inside the repository to put the formula. # Default is the root folder. folder: Formula - # Your app's homepage. - # Default is empty. - homepage: "https://sourcegraph.com/" - - # Your app's description. - # Default is empty. - description: "Sourcegraph CLI" diff --git a/.travis.yml b/.travis.yml index cbbaaca6c4..cadba69243 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,19 +5,17 @@ go_import_path: github.com/sourcegraph/src-cli install: - go get -d -t ./... - go test -i ./... - - go get -u github.com/mitchellh/gox - - mkdir release - - cd release && gox -ldflags="-X 'main.buildTag=`git tag --contains $(git rev-parse HEAD) | grep -v latest | tail -1`'" -arch 'amd64' -os 'linux windows darwin' ../cmd/... script: - cd $TRAVIS_BUILD_DIR - go test -race -v ./... +env: + global: + - secure: UoKg6fE1QlXTrYdY+AdaQ8WogXEydYhb5MTbabLbpC7byuopM/FHPXOTJ97+bsYgaVH3sElDJR1+v3PLm5lDeM9o2l1/Hnf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6IVsMw3V8ThUWz1XXO6DE03jnk88y/LrIFuu+E1RLzgfmBo3NNb5GwcgrTm3v3ti0ObRPC1Cfyr3g2FoCfs+3I8ecrKs8Md9Pf5gN/xevHzLnTPj6Yq976ElympPnPeXTekF26ymsMJUvNj+2WZogEYFp5xkeXfvnQUTOgQVQn5FTWVf0/h4Dgy6j8JT1YUmdAeqZkfLi0xWWkMOnm0ofvU6gglELDS4= - file_glob: true - file: release/* +- provider: script + script: curl -sL https://git.io/goreleaser | bash overwrite: true skip_cleanup: true on: tags: true + condition: $TRAVIS_OS_NAME = linux diff --git a/go.sum b/go.sum index d002e68fe8..3be8f3303e 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,6 @@ github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY= -github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= From c8bb2d83020e7106bc86ddf1b44c53b356b49775 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 19 Feb 2020 15:44:46 +0100 Subject: [PATCH 3/8] Update .goreleaser.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: ᴜɴᴋɴᴡᴏɴ --- .goreleaser.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 75f92863d7..c34750e451 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,7 +18,7 @@ builds: goarch: - amd64 env: - - CGO_ENABLED=0 + - CGO_ENABLED=0 brews: - name: src-cli @@ -30,4 +30,3 @@ brews: # Folder inside the repository to put the formula. # Default is the root folder. folder: Formula - From ebb20ba6ecd16250bb429da359641ba1c8a1e239 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 20 Feb 2020 09:42:43 +0100 Subject: [PATCH 4/8] Move env vars into one setting --- .goreleaser.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index c34750e451..4d0255b079 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,7 @@ dist: release env: - GO111MODULE=on + - CGO_ENABLED=0 before: hooks: - go mod download @@ -17,8 +18,6 @@ builds: - darwin goarch: - amd64 - env: - - CGO_ENABLED=0 brews: - name: src-cli From 6c0bd18d10454d35b656d23d1a2eed72c47e7101 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 20 Feb 2020 09:45:17 +0100 Subject: [PATCH 5/8] Fix ldflags in goreleaser config --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 4d0255b079..74e57ac64e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,7 +11,7 @@ builds: main: ./cmd/src/ binary: src ldflags: - - -X main.build={{.Version}} + - -X main.buildTag={{.Version}} goos: - linux - windows From 467df41ef440ff8165dab1f124cb1c595d518666 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Fri, 21 Feb 2020 16:27:35 +0100 Subject: [PATCH 6/8] Change goreleaser config to use binary releases --- .goreleaser.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 74e57ac64e..410488afe6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,6 +18,11 @@ builds: - darwin goarch: - amd64 +archives: +- id: bin + format: binary + wrap_in_directory: false + name_template: "src_{{ .Os }}_{{ .Arch }}" brews: - name: src-cli @@ -29,3 +34,9 @@ brews: # Folder inside the repository to put the formula. # Default is the root folder. folder: Formula +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' From b048bab426130833aedbff30e49c2ce46a6f3684 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 25 Feb 2020 09:11:08 +0100 Subject: [PATCH 7/8] Add new GITHUB_TOKEN to .travis.yml --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index cadba69243..1828005ccc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,16 @@ language: go go: - - 1.13.x +- 1.13.x go_import_path: github.com/sourcegraph/src-cli install: - - go get -d -t ./... - - go test -i ./... +- go get -d -t ./... +- go test -i ./... script: - - cd $TRAVIS_BUILD_DIR - - go test -race -v ./... +- cd $TRAVIS_BUILD_DIR +- go test -race -v ./... env: global: - - secure: UoKg6fE1QlXTrYdY+AdaQ8WogXEydYhb5MTbabLbpC7byuopM/FHPXOTJ97+bsYgaVH3sElDJR1+v3PLm5lDeM9o2l1/HnfZK5M5iiNrktxNUOo+ppX6i4ylQ+AHEgRUc5zS3hYkNbXRu4IVULevmHsCUX1MchI7t+56uVZkSE3yFxGi8jTUm/cAyFX6MNyuOGXRlew2ivgKhJ/OT0ebxWaCxz/sn5H+1Cmr7r7Pf45vx9XpbY2wd7NqwsFa+w42z2hvEur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BQMNbpE= deploy: - provider: script script: curl -sL https://git.io/goreleaser | bash @@ -18,4 +18,4 @@ deploy: skip_cleanup: true on: tags: true - condition: $TRAVIS_OS_NAME = linux + condition: "$TRAVIS_OS_NAME = linux" From 54824998a42f66ddaa80d1f9ec39210f71b8a43d Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 25 Feb 2020 09:18:32 +0100 Subject: [PATCH 8/8] Create tarballs with goreleaser for Homebrew formula --- .goreleaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 410488afe6..e3c13172f6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -19,6 +19,8 @@ builds: goarch: - amd64 archives: +- id: tarball + format: tar.gz - id: bin format: binary wrap_in_directory: false