Skip to content

Commit

Permalink
Action Server 0.5.3 from sema4ai
Browse files Browse the repository at this point in the history
  • Loading branch information
kariharju committed Apr 26, 2024
1 parent c5d1d5f commit f7c5cd4
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts/version.txt
4 changes: 2 additions & 2 deletions Casks/action-server.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cask "action-server" do
version "0.4.1"
sha256 "c9b1c1cd978fd615930214a36eace590120006e0dc76e57f25440772c6655c3f"
version "0.5.3"
sha256 "e4e14c12f13a6ff8622053ae2fdfe759f679194e86c21e58d3963904dc60c68a"

# robocorp.com was verified as official when first introduced to the cask
url "https://sema4.ai/cdn/downloads/action-server/releases/#{version}/macos64/action-server"
Expand Down
48 changes: 48 additions & 0 deletions scripts/homebrew-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Change to the directory where the script is located
cd "$(dirname "$0")"

# Variables
TEMPLATE_PATH="./recipe-template.txt"
OUTPUT_PATH="../Casks/action-server.rb"
LATEST_VERSION_URL="https://sema4.ai/cdn/downloads/action-server/releases/latest/version.txt"

# Check if version number is provided as an argument
if [ "$#" -eq 0 ]; then
echo "No version provided. Fetching latest version number from ${LATEST_VERSION_URL}..."
VERSION=$(curl -s $LATEST_VERSION_URL)
if [ $? -ne 0 ] || [ -z "$VERSION" ]; then
echo "Failed to fetch latest version number."
exit 1
fi
elif [ "$#" -eq 1 ]; then
VERSION=$1
else
echo "Usage: $0 [<version>]"
exit 1
fi

DOWNLOAD_URL="https://sema4.ai/cdn/downloads/action-server/releases/${VERSION}/macos64/action-server"

# Fetch the latest binary and compute its SHA256 hash
echo "Downloading the executable from ${DOWNLOAD_URL} to compute SHA256..."
curl -Ls $DOWNLOAD_URL -o /tmp/action-server
if [ $? -ne 0 ]; then
echo "Failed to download the executable."
exit 2
fi

NEW_SHA256=$(shasum -a 256 /tmp/action-server | awk '{print $1}')
if [ -z "$NEW_SHA256" ]; then
echo "Failed to compute SHA256."
exit 3
fi

# Read the template and replace placeholders with actual values
echo "Updating formula based on template..."
sed "s/#VERSION#/${VERSION}/g; s/#HASH#/${NEW_SHA256}/g" $TEMPLATE_PATH > $OUTPUT_PATH

# Display the updated formula for debugging
echo "Updated formula written to ${OUTPUT_PATH}:"
cat $OUTPUT_PATH
12 changes: 12 additions & 0 deletions scripts/recipe-template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cask "action-server" do
version "#VERSION#"
sha256 "#HASH#"

# robocorp.com was verified as official when first introduced to the cask
url "https://sema4.ai/cdn/downloads/action-server/releases/#{version}/macos64/action-server"
name "action-server"
desc "Command line tool for running AI Actions on Sema4.ai Action Server."
homepage "https://github.com/Sema4AI/actions"

binary "action-server"
end

0 comments on commit f7c5cd4

Please sign in to comment.