github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/ci/cli-release/tasks/update-brew-formula.yml (about)

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