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