Skip to content

Commit

Permalink
Update the Homebrew Formula on release
Browse files Browse the repository at this point in the history
  • Loading branch information
weiss committed Oct 3, 2023
1 parent 82c8203 commit ed87cd1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/publish-release
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ done
createrepo_c "$rpm_repo_dir"
gpg --detach-sign --armor "$rpm_repo_dir/repodata/repomd.xml"

# Update Homebrew Formula.
tools/update-formula

cat >"$web_root_dir/install" <<-EOF
#!/bin/sh
set -e
Expand Down
40 changes: 40 additions & 0 deletions tools/update-formula
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh

# Update the Homebrew Formula.

set -e
set -u

rel_name='eturnal'
rel_vsn=$(tools/get-version)
rel_tar="$rel_name-$rel_vsn.tar.gz"
rel_dir='/home/eturnal/web/download'
formula="Formula/$rel_name.rb"
url="https://$rel_name.net/download"
myself=${0##*/}

usage()
{
echo >&2 "Usage: $myself"
exit 2
}

if ! [ -e 'rebar.config' ] || ! [ -e "tools/$myself" ]
then
echo >&2 "Please call this script from the repository's root directory."
exit 2
elif ! [ -e "$rel_dir/$rel_tar" ]
then
echo >&2 "Cannot find $rel_tar in $rel_dir"
exit 1
elif [ $# -ne 0 ]
then
usage
fi

sum=$(sha256sum "$rel_dir/$rel_tar" | cut -d ' ' -f 1)

sed -i -e "s|^\( *\)url.*|\\1url \"$url/$rel_tar\"|" \
-e "s|^\( *\)sha256.*|\\1sha256 \"$sum\"|" "$formula"
git add "$formula"
git commit -m "Formula: update to $rel_vsn"

0 comments on commit ed87cd1

Please sign in to comment.