github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/ci/cli/tasks/update-brew-formula.yml (about)

     1  ---
     2  platform: linux
     3  image: docker:///cloudfoundry/cli-ci
     4  
     5  inputs:
     6  - name: final-cli
     7    path: cli
     8  - name: cf-cli-osx-tarball
     9  - name: homebrew-tap
    10  
    11  outputs:
    12  - name: update-brew-formula-output
    13  
    14  params:
    15    OUTPUT_PATH: update-brew-formula-output
    16  
    17  run:
    18    path: bash
    19    args:
    20    - -c
    21    - |
    22      set -ex
    23  
    24      pushd cf-cli-osx-tarball
    25        CLI_SHA256=$(shasum -a 256 cf-cli_*_osx.tgz | cut -d ' ' -f 1)
    26      popd
    27  
    28      CLI_VERSION=$(cat cli/VERSION)
    29  
    30      pushd homebrew-tap
    31        cat <<EOF > cf-cli.rb
    32      require 'formula'
    33  
    34      class CfCli < Formula
    35        homepage 'https://github.com/cloudfoundry/cli'
    36        head 'https://cli.run.pivotal.io/edge?arch=macosx64&source=homebrew'
    37        url 'https://cli.run.pivotal.io/stable?release=macosx64-binary&version=${CLI_VERSION}&source=homebrew'
    38        version '${CLI_VERSION}'
    39        sha256 '${CLI_SHA256}'
    40  
    41        depends_on :arch => :x86_64
    42  
    43        conflicts_with "pivotal/tap/cloudfoundry-cli", :because => "the Pivotal tap ships an older cli distribution"
    44        conflicts_with "caskroom/cask/cloudfoundry-cli", :because => "the caskroom tap is not the official distribution"
    45  
    46        def install
    47          bin.install 'cf'
    48        end
    49  
    50        test do
    51          system "#{bin}/cf"
    52        end
    53      end
    54      EOF
    55  
    56        git add cf-cli.rb
    57        git config --global user.email "cf-cli-eng@pivotal.io"
    58        git config --global user.name "Concourse CI"
    59        git commit -m "Release ${CLI_VERSION}"
    60      popd
    61  
    62      cp -R homebrew-tap $OUTPUT_PATH