github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/ci/cli/tasks/build-binaries.yml (about) 1 platform: linux 2 3 image_resource: 4 type: docker-image 5 source: 6 repository: cfcli/cli-base 7 8 inputs: 9 - name: cli 10 path: gopath/src/code.cloudfoundry.org/cli 11 - name: i18n-data 12 13 outputs: 14 - name: cross-compiled 15 16 run: 17 path: bash 18 args: 19 - -c 20 - | 21 set -ex 22 23 cwd=$PWD 24 25 export GOPATH=$PWD/gopath 26 export PATH=$GOPATH/bin:$PATH 27 28 go version 29 30 mv i18n-data/i18n_resources.go $GOPATH/src/code.cloudfoundry.org/cli/i18n/resources 31 32 pushd $GOPATH/src/code.cloudfoundry.org/cli 33 BUILD_VERSION=$(cat ci/VERSION) 34 BUILD_SHA=$(git rev-parse --short HEAD) 35 BUILD_DATE=$(date -u +"%Y-%m-%d") 36 37 VERSION_LDFLAGS="-X code.cloudfoundry.org/cli/version.binaryVersion=${BUILD_VERSION} -X code.cloudfoundry.org/cli/version.binarySHA=${BUILD_SHA} -X code.cloudfoundry.org/cli/version.binaryBuildDate=${BUILD_DATE}" 38 39 echo "Building 32-bit Linux" 40 CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\" ${VERSION_LDFLAGS}" -o out/cf-cli_linux_i686 . 41 42 echo "Building 64-bit Linux" 43 CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\" ${VERSION_LDFLAGS}" -o out/cf-cli_linux_x86-64 . 44 45 # This to to add the CF Icon into the windows executable 46 go get github.com/akavel/rsrc 47 rsrc -ico ci/installers/windows/cf.ico 48 49 echo "Building 32-bit Windows" 50 GOARCH=386 GOOS=windows go build -tags="forceposix" -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_win32.exe . 51 52 echo "Building 64-bit Windows" 53 GOARCH=amd64 GOOS=windows go build -tags="forceposix" -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_winx64.exe . 54 55 echo "Creating tarball" 56 tar -cvzf $cwd/cross-compiled/cf-cli-binaries.tgz -C out . 57 popd