From b6ca12b53d77e52d8bc60cc4fc4d4f21081b9049 Mon Sep 17 00:00:00 2001 From: Nayden Petrov Date: Fri, 16 Oct 2026 08:09:01 +0300 Subject: [PATCH] Update release workflow to keep cf-cli formula in sync with latest The update-homebrew job only wrote cf-cli@N.rb on each release, leaving the unversioned cf-cli formula stale on the tap. Add a second heredoc to generate cf-cli.rb with class CfCli using the same checksums and URLs, and stage it alongside the versioned file. Also fix a shell syntax bug: missing space before ] in the porcelain check caused the condition to always be true. Fixes cloudfoundry/homebrew-tap#94 --- .github/workflows/release-update-repos.yml | 39 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-update-repos.yml b/.github/workflows/release-update-repos.yml index 7a69c5c39c..8a2f6dd2bf 100644 --- a/.github/workflows/release-update-repos.yml +++ b/.github/workflows/release-update-repos.yml @@ -173,6 +173,41 @@ jobs: system "#{bin}/cf${VERSION_MAJOR}" end end + EOF + + cat < cf-cli.rb + class CfCli < Formula + desc "Cloud Foundry CLI" + homepage "https://code.cloudfoundry.org/cli" + version "${VERSION_BUILD}" + + if OS.mac? + if Hardware::CPU.arm? + url "${CLAW_URL}/homebrew?arch=macosarm&version=${VERSION_BUILD}" + sha256 "${CLI_MACOSARM_SHA256}" + elsif + url "${CLAW_URL}/homebrew?arch=macosx64&version=${VERSION_BUILD}" + sha256 "${CLI_OSX_SHA256}" + end + elsif OS.linux? + url "${CLAW_URL}/stable?release=linux64-binary&version=${VERSION_BUILD}&source=homebrew" + sha256 "${CLI_LINUX_64_SHA256}" + end + + def install + bin.install "cf${VERSION_MAJOR}" + bin.install_symlink "cf${VERSION_MAJOR}" => "cf" + (bash_completion/"cf${VERSION_MAJOR}-cli").write <<-completion + $(cat ../cli-ci/ci/installers/completion/cf${VERSION_MAJOR}) + completion + doc.install "LICENSE" + doc.install "NOTICE" + end + + test do + system "#{bin}/cf${VERSION_MAJOR}" + end + end EOF popd @@ -180,9 +215,9 @@ jobs: - name: Commit new homebrew formula run: | pushd homebrew-tap - git add cf-cli@${VERSION_MAJOR}.rb + git add cf-cli@${VERSION_MAJOR}.rb cf-cli.rb - if ! [ -z "$(git status --porcelain)"]; then + if ! [ -z "$(git status --porcelain)" ]; then git config user.name cf-cli-eng git config user.email cf-cli-eng@pivotal.io git commit -m "Release CF CLI ${VERSION_BUILD}"