From 0a9f113f66a721d9552ab9d0047a83109a0a763b Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Tue, 6 Mar 2018 15:14:17 +0100 Subject: [PATCH 1/2] Build multiplatform binaries. --- .circleci/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5100a1..762409a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,13 +17,14 @@ jobs: - deps-vendor # specify any bash command here prefixed with `run: ` - run: ./dep ensure -v + - run: go get github.com/mitchellh/gox - save_cache: key: deps-vendor paths: - "vendor" - run: go test -v ./... - - run: go build + - run: gox -output "dist/pipet_{{.OS}}_{{.Arch}}" -os "freebsd linux netbsd darwin" -arch "amd64 386 arm" -osarch "!darwin/arm" - store_artifacts: - path: pipet - destination: pipet-amd64 + path: dist + dest: dist From 4284f303595e0cc96ccc3719b9c17e8b772d1a42 Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Tue, 6 Mar 2018 17:17:08 +0100 Subject: [PATCH 2/2] Deploy on version tags --- .circleci/config.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 762409a..fa0c854 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,3 +28,38 @@ jobs: - store_artifacts: path: dist dest: dist + deploy: + docker: + - image: circleci/golang:1.10 + + working_directory: /go/src/github.com/dbalan/pipet + steps: + - checkout + - run: curl -L https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 > dep + - run: chmod a+x dep + - restore_cache: + keys: + - deps-vendor + # specify any bash command here prefixed with `run: ` + - run: ./dep ensure -v + - run: go get github.com/mitchellh/gox github.com/tcnksm/ghr + - save_cache: + key: deps-vendor + paths: + - "vendor" + - run: gox -output "dist/pipet_{{.OS}}_{{.Arch}}" -os "freebsd linux netbsd darwin" -arch "amd64 386 arm" -osarch "!darwin/arm" + - run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace $(git describe --tags) dist/ + + + +workflows: + version: 2 + build-and-deploy: + jobs: + - build + - deploy: + requires: + - build + filters: + branches: + only: master