Apache DataFusion SQL Query Engine
Automate postrelease publishing to Homebrew (#3507)
Ian Alexander Joiner010b3526a763
diff --git a/dev/release/README.md b/dev/release/README.mdindex 06023ce08c..e7db35396c 100644--- a/dev/release/README.md+++ b/dev/release/README.md@@ -317,7 +317,13 @@ The CLI needs a `--no-verify` argument because `build.rs` generates source into### Publish datafusion-cli on Homebrew-For Homebrew, Send a simple PR to update tag and commit hash for the datafusion+Run `publish_homebrew.sh` to publish `datafusion-cli` on Homebrew.++```+dev/release/publish_homebrew.sh <version> <github-user> <github-token> <homebrew-default-branch-name>+```++Alternatively manually send a simple PR to update tag and commit hash for the datafusionformula in homebrew-core. Here is an example PR:https://github.com/Homebrew/homebrew-core/pull/89562.diff --git a/dev/release/publish_homebrew.sh b/dev/release/publish_homebrew.shnew file mode 100644index 0000000000..876a974e90--- /dev/null+++ b/dev/release/publish_homebrew.sh@@ -0,0 +1,83 @@+#!/usr/bin/env bash+#+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++set -ue++if [ "$#" -ne 3 ]; then+ echo "Usage: $0 <version> <github-user> <github-token> <homebrew-default-branch-name>"+ exit 1+fi++version=$1+github_user=$2+github_token=$3+# Prepare for possible renaming of the default branch on Homebrew+homebrew_default_branch_name=$4++url="https://www.apache.org/dyn/closer.lua?path=arrow/arrow-datafusion-${version}/apache-arrow-datafusion-${version}.tar.gz"+sha256="$(curl https://dist.apache.org/repos/dist/release/arrow/arrow-datafusion-${version}/apache-arrow-datafusion-${version}.tar.gz.sha256 | cut -d' ' -f1)"++pushd "$(brew --repository homebrew/core)"++if ! git remote | grep -q --fixed-strings ${github_user}; then+ echo "Setting ''${github_user}' remote"+ git remote add ${github_user} [email protected]:${github_user}/homebrew-core.git+fi++echo "Updating working copy"+git fetch --all --prune --tags --force -j$(nproc)++branch=apache-arrow-datafusion-${version}+echo "Creating branch: ${branch}"+git branch -D ${branch} || :+git checkout -b ${branch} origin/master++echo "Updating datafusion formulae"+brew bump-formula-pr \+ --commit \+ --no-audit \+ --sha256="${sha256}" \+ --url="${url}" \+ --verbose \+ --write-only \+ datafusion++echo "Testing datafusion formulae"+brew uninstall datafusion || :+brew install --build-from-source datafusion+brew test datafusion+brew audit --strict datafusion++git push -u $github_user ${branch}++git checkout -++popd++echo "Create the pull request"+title="datafusion ${version}"+body="Created using \`bump-formula-pr\`"+data="{\"title\":\"$title\", \"body\":\"$body\", \"head\":\"$github_username:$branch\", \"base\":\"$homebrew_default_branch_name\"}"+curl -X POST \+ -H "Accept: application/vnd.github+json" \+ -H "Authorization: Bearer $github_token" \+ https://api.github.com/repos/Homebrew/homebrew-core/pulls \+ -d "$data"++echo "Complete!"