github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/ci/cli/tasks/build-osx-binary.yml (about)

     1  ---
     2  platform: darwin
     3  
     4  inputs:
     5  - name: cli-ci
     6  - name: cli
     7    path: gopath/src/code.cloudfoundry.org/cli
     8  - name: i18n-data
     9  
    10  outputs:
    11  - name: osx-compiled
    12  
    13  run:
    14    path: bash
    15    args:
    16    - -c
    17    - |
    18      set -ex
    19  
    20      cwd=$PWD
    21      export GOPATH=$PWD/gopath
    22      export PATH=$GOPATH/bin:$PATH
    23  
    24      go version
    25  
    26      mv i18n-data/i18n_resources.go $GOPATH/src/code.cloudfoundry.org/cli/i18n/resources
    27  
    28      pushd $GOPATH/src/code.cloudfoundry.org/cli
    29        BUILD_VERSION=$(cat BUILD_VERSION)
    30        BUILD_SHA=$(git rev-parse --short HEAD)
    31        BUILD_DATE=$(date -u +"%Y-%m-%d")
    32  
    33        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}"
    34  
    35        echo "Building 64-bit Darwin"
    36        GOARCH=amd64 GOOS=darwin go build -ldflags "-w -s ${VERSION_LDFLAGS}" -o out/cf-cli_osx .
    37  
    38        echo "Creating tarball"
    39        tar -cvzf $cwd/osx-compiled/cf-cli-osx-binary.tgz -C out .
    40      popd