Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/homebrew-install.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: brew test-bot

on:
push:
branches:
- main
pull_request:

concurrency:
group: homebrew-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test-bot:
strategy:
matrix:
os: [ ubuntu-22.04, macos-15-intel, macos-26 ]
runs-on: ${{ matrix.os }}
permissions:
actions: read
checks: read
contents: read
pull-requests: read
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@main
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache Homebrew Bundler RubyGems
uses: actions/cache@v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ matrix.os }}-rubygems-

- run: brew test-bot --only-cleanup-before

- run: brew test-bot --only-setup

- run: brew test-bot --only-tap-syntax

- run: brew test-bot --only-formulae
if: github.event_name == 'pull_request'

- run: brew test dify

# - name: Upload bottles as artifact
# if: always() && github.event_name == 'pull_request'
# uses: actions/upload-artifact@v4
# with:
# name: bottles_${{ matrix.os }}
# path: '*.bottle.*'
58 changes: 38 additions & 20 deletions dify.rb
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
# typed: strict
# frozen_string_literal: true

# Dify
class Dify < Formula
desc "Dify is a cli tool to help you develop your Dify projects."
desc "CLI tool for Dify plugin development"
homepage "https://github.com/langgenius/dify-plugin-daemon"
license "MIT"
version "0.3.1"

livecheck do
url :stable
strategy :github_latest
os_name=if OS.mac?
"darwin"
elsif OS.linux?
"linux"
else
"unknown"
end

os_name = OS.mac? ? "darwin" : (OS.linux? ? "linux" : "unknown")
arch_name = Hardware::CPU.arm? ? "arm64" : (Hardware::CPU.intel? ? "amd64" : "unknown")
CLI_BIN_NAME = "dify-plugin-#{os_name}-#{arch_name}"
arch_name=if Hardware::CPU.arm?
"arm64"
elsif Hardware::CPU.intel?
"amd64"
else
"unknown"
end

CHECKSUM_MAP = {
"dify-plugin-darwin-amd64" => "1b0636f9e106ab71e15c5276d931020b9bd427211fd91c8b7dca22ca243802b8",
"dify-plugin-darwin-arm64" => "5fece620cb415607b88e1e7628e3c412d6db605a85d50820d1a889631cb7f40e",
"dify-plugin-linux-amd64" => "d5537d49cab12a61e510071e25efa26aefe969fbcc788e8760eca436b9daeee1",
"dify-plugin-linux-arm64" => "e82dde9fc1068c8c20478744fb0190f11d9fc5f68d8248e5d84fb36a238bcaf7",
}
CLI_BIN_NAME = "dify-plugin-#{os_name}-#{arch_name}".freeze

def self.get_sha256(cli_name)
CHECKSUM_MAP.fetch(cli_name) do |key|
raise "Failed to find SHA256 checksum for the file `#{key}`"
end
end

# Define the URL and the SHA256 checksum for binary file
url "#{homepage}/releases/download/#{version}/#{CLI_BIN_NAME}"
CHECKSUM_MAP = {
"dify-plugin-darwin-amd64" => "55ec70958cb313e9026c8969f35c5de4c50e044102816f84450de5edeae70d0a",
"dify-plugin-darwin-arm64" => "95dd55c2e949eaf716a5574121f6d86c80afbf1abbc552e8d4ddceb5a0f8028b",
"dify-plugin-linux-amd64" => "f26e5e5faae3d3931979798932aa6542c71de827b470132f385a95e0d74c5dcf",
"dify-plugin-linux-arm64" => "078149cf70cd3f1fdee11b733c1f1e49e594628f69c22a60a1ca0abeabe3569d",
}.freeze

url "#{homepage}/releases/download/0.3.2/#{CLI_BIN_NAME}"
version "0.3.2"
sha256 get_sha256(CLI_BIN_NAME)

livecheck do
url :stable
strategy :github_latest
end

# Define the URL and the SHA256 checksum for binary file

def install
# move the binary file to bin directory
bin.install "#{CLI_BIN_NAME}" => "dify"
system "chmod +x #{bin}/dify"
system "#{bin}/dify version"
bin.install CLI_BIN_NAME.to_s => "dify"
chmod("+x", "#{bin}/dify")
system "#{bin}/dify", "version"
end

test do
Expand Down
Loading