Commit 073762c1 by Mislav Marohnić

Further simplify `script/brew-publish`

parent 231a3f02
#!/bin/bash #!/bin/bash
# Usage: script/brew-publish <name> <version> [<gh-project>] # Usage: script/brew-publish <formula-name> <repo> <version>
# set -euo pipefail
# Updates the `<name>.rb` Homebrew formula to `<version>` and sends a pull
# request with the change.
set -e
brew_name="${1?}" brew_name="${1?}"
version="${2?}" repo="${2?}"
version="${3?}"
if [ -n "$3" ]; then shift 3
gh_project="github.com/${3}"
else
gh_project="$(git remote -v | grep '^origin' | grep -oE 'github.com[:/][^/]+/[^/ ]+' | head -1)"
gh_project="${gh_project%.git}"
fi
url="https://${gh_project/:/\/}/archive/${version}.tar.gz"
url="https://github.com/${repo}/archive/${version}.tar.gz"
checksum="$(curl -fsSL "$url" | shasum -a 256 -b | awk '{print $1}')" checksum="$(curl -fsSL "$url" | shasum -a 256 -b | awk '{print $1}')"
if [ -z "$checksum" ]; then brew bump-formula-pr --url="$url" --sha256="$checksum" "$brew_name" "$@"
echo "ERROR: calculating the checksum failed for $url" >&2
exit 1
fi
brew bump-formula-pr --url=$url --sha256=$checksum $brew_name
...@@ -41,7 +41,6 @@ git push origin master "${version_tag}" ...@@ -41,7 +41,6 @@ git push origin master "${version_tag}"
{ echo "ruby-build ${new_version}" { echo "ruby-build ${new_version}"
echo echo
git log --no-merges --format='%w(0,0,2)* %B' --reverse "${previous_tag}..HEAD^" -- bin share git log --no-merges --format='%w(0,0,2)* %B' --reverse "${previous_tag}..HEAD^" -- bin share
} | hub release create -dF - -c "$(git rev-parse HEAD)" "$version_tag" || true } | hub release create -dF - "$version_tag" || true
hub browse -- "releases/${version_tag}"
script/brew-publish ruby-build "$version_tag" script/brew-publish ruby-build rbenv/ruby-build "$version_tag"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment