github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+incompatible/ci/cli-v7/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/BUILD_VERSION_V7) 27 28 mkdir cf-cli-osx-tarball cf-cli-linux-tarball 29 curl -L "https://packages.cloudfoundry.org/stable?release=macosx64-binary&version=${VERSION}&source=github-rel" > cf-cli-osx-tarball/cf-cli_${VERSION}_osx.tgz 30 curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${VERSION}&source=github-rel" > cf-cli-linux-tarball/cf-cli_${VERSION}_linux64.tgz 31 32 pushd cf-cli-osx-tarball 33 CLI_OSX_SHA256=$(shasum -a 256 cf-cli_*_osx.tgz | cut -d ' ' -f 1) 34 popd 35 36 pushd cf-cli-linux-tarball 37 CLI_LINUX_64_SHA256=$(shasum -a 256 cf-cli_*_linux64.tgz | cut -d ' ' -f 1) 38 popd 39 40 pushd homebrew-tap 41 cat <<EOF > cf7-cli.rb 42 require 'formula' 43 44 class Cf7Cli < Formula 45 homepage 'https://code.cloudfoundry.org/cli' 46 version '${VERSION}' 47 48 if OS.mac? 49 head 'https://packages.cloudfoundry.org/edge?arch=macosx64&source=homebrew' 50 url 'https://packages.cloudfoundry.org/homebrew/cf-${VERSION}.tgz' 51 sha256 '${CLI_OSX_SHA256}' 52 elsif OS.linux? 53 head 'https://packages.cloudfoundry.org/edge?arch=linux64&source=homebrew' 54 url 'https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${VERSION}&source=homebrew' 55 sha256 '${CLI_LINUX_64_SHA256}' 56 end 57 58 depends_on :arch => :x86_64 59 60 def install 61 bin.install 'cf7' 62 (bash_completion/"cf7-cli").write <<-completion 63 $(cat ../cli/ci/installers/completion/cf7) 64 completion 65 doc.install 'LICENSE' 66 doc.install 'NOTICE' 67 end 68 69 test do 70 system "#{bin}/cf7" 71 end 72 end 73 EOF 74 75 git add cf7-cli.rb 76 if ! [ -z "$(git status --porcelain)"]; 77 then 78 git config --global user.email "cf-cli-eng@pivotal.io" 79 git config --global user.name "Concourse CI" 80 git commit -m "Release ${VERSION}" 81 else 82 echo "no new version to commit" 83 fi 84 cat cf7-cli.rb 85 popd 86 87 cp -R homebrew-tap $OUTPUT_PATH 88