Skip to content

Commit

Permalink
feat: support different versions for brew install (#29)
Browse files Browse the repository at this point in the history
* chore: updated update-formula script
  • Loading branch information
kridai authored Feb 8, 2022
1 parent d47c907 commit 558c52b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/scripts/update-formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ sha=$3
if [ "$version" == '' ] || [ "$sha" == '' ]; then
exit
fi
#fetch the current version
current_version=$(grep -w "version " Formula/$formula.rb | awk '{print $2}' | tr -d \")
echo "Current version $current_version"
if [ "$version" != "$current_version" ]; then
cp Formula/$formula.rb Formula/$formula@$current_version.rb
class_name=$(echo $formula | sed -e "s/\b./\u&/g")AT$(echo $current_version | tr -dc '[:alnum:]\n\r' | sed 's/[[:alpha:]]/\U&/')
sed -i.bak "s/^class [^ ]*/class $class_name/" Formula/$formula@$current_version.rb
fi
formula_path="Formula/$formula.rb"
sed -E -i.bak "s/twilio-v$version_pattern/twilio-v$version/g" "$formula_path"
sed -i.bak "s/version .*/version \"$version\"/" "$formula_path"
Expand Down

0 comments on commit 558c52b

Please sign in to comment.