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