Skip to content

Commit

Permalink
chore: brew must use prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazer committed Jun 13, 2024
1 parent 93c0b0a commit 309fc2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ jobs:
- name: Validate Homebrew Formula
uses: LizardByte/[email protected]
env:
IS_PR: ${{ env.IS_PR }}
HOMEBREW_IS_PR: ${{ env.IS_PR }}
with:
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
git_email: ${{ secrets.GH_BOT_EMAIL }}
Expand Down
22 changes: 10 additions & 12 deletions packaging/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class @PROJECT_NAME@ < Formula
desc "@PROJECT_DESCRIPTION@"
homepage "@PROJECT_HOMEPAGE_URL@"
if ENV["IS_PR"] == "1"
if ENV["HOMEBREW_IS_PR"] == "1"
url "@GITHUB_CLONE_URL@", branch: "@GITHUB_BRANCH@", revision: "@GITHUB_COMMIT@"
else
url "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@", tag: "@BUILD_VERSION@"
Expand All @@ -12,17 +12,15 @@ class @PROJECT_NAME@ < Formula
license all_of: ["GPL-3.0-only"]
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"

if ENV["IS_PR"] != "1"
# https://docs.brew.sh/Brew-Livecheck#githublatest-strategy-block
livecheck do
url :stable
regex(/^v?(\d+\.\d+\.\d+)$/i)
strategy :github_latest do |json, regex|
match = json["tag_name"]&.match(regex)
next if match.blank?

match[1]
end
# https://docs.brew.sh/Brew-Livecheck#githublatest-strategy-block
livecheck do
url :stable
regex(/^v?(\d+\.\d+\.\d+)$/i)
strategy :github_latest do |json, regex|
match = json["tag_name"]&.match(regex)
next if match.blank?

match[1]
end
end

Expand Down

0 comments on commit 309fc2d

Please sign in to comment.