5858 update-tap :
5959 needs : upload
6060 runs-on : ubuntu-latest
61+ if : ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
6162 steps :
6263 - name : Update Homebrew tap
6364 env :
@@ -70,25 +71,25 @@ jobs:
7071 SHA_X86_64=$(curl -sL "$BASE_URL/dualentry-macos-x86_64" | shasum -a 256 | cut -d' ' -f1)
7172 SHA_LINUX=$(curl -sL "$BASE_URL/dualentry-linux-x86_64" | shasum -a 256 | cut -d' ' -f1)
7273
73- cat > /tmp/dualentry.rb << FORMULA
74+ cat > /tmp/dualentry.rb <<' FORMULA'
7475 class Dualentry < Formula
7576 desc "DualEntry accounting CLI"
76- homepage "https://github.com/${{ github.repository }} "
77- version "$VERSION "
77+ homepage "https://github.com/dualentry/dualentry-cli "
78+ version "VERSION_PLACEHOLDER "
7879
7980 on_macos do
8081 if Hardware::CPU.arm?
81- url "$BASE_URL /dualentry-macos-arm64"
82- sha256 "$SHA_ARM64 "
82+ url "URL_PLACEHOLDER /dualentry-macos-arm64"
83+ sha256 "SHA_ARM64_PLACEHOLDER "
8384 else
84- url "$BASE_URL /dualentry-macos-x86_64"
85- sha256 "$SHA_X86_64 "
85+ url "URL_PLACEHOLDER /dualentry-macos-x86_64"
86+ sha256 "SHA_X86_64_PLACEHOLDER "
8687 end
8788 end
8889
8990 on_linux do
90- url "$BASE_URL /dualentry-linux-x86_64"
91- sha256 "$SHA_LINUX "
91+ url "URL_PLACEHOLDER /dualentry-linux-x86_64"
92+ sha256 "SHA_LINUX_PLACEHOLDER "
9293 end
9394
9495 def install
@@ -102,6 +103,14 @@ jobs:
102103 end
103104 FORMULA
104105
106+ # Substitute placeholders and strip leading whitespace
107+ sed -i "s|VERSION_PLACEHOLDER|$VERSION|g" /tmp/dualentry.rb
108+ sed -i "s|URL_PLACEHOLDER|$BASE_URL|g" /tmp/dualentry.rb
109+ sed -i "s|SHA_ARM64_PLACEHOLDER|$SHA_ARM64|g" /tmp/dualentry.rb
110+ sed -i "s|SHA_X86_64_PLACEHOLDER|$SHA_X86_64|g" /tmp/dualentry.rb
111+ sed -i "s|SHA_LINUX_PLACEHOLDER|$SHA_LINUX|g" /tmp/dualentry.rb
112+ sed -i 's/^ //' /tmp/dualentry.rb
113+
105114 git clone "https://x-access-token:${TAP_TOKEN}@github.com/dualentry/homebrew-tap.git" /tmp/tap
106115 mkdir -p /tmp/tap/Formula
107116 cp /tmp/dualentry.rb /tmp/tap/Formula/dualentry.rb
0 commit comments