You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ag...@apache.org on 2022/10/03 18:45:28 UTC

[arrow-datafusion] branch master updated: Automate postrelease publishing to Homebrew (#3507)

This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 010b3526a Automate postrelease publishing to Homebrew (#3507)
010b3526a is described below

commit 010b3526a763b5eca73bba501965901d605935d6
Author: Ian Alexander Joiner <ia...@gmail.com>
AuthorDate: Mon Oct 3 14:45:21 2022 -0400

    Automate postrelease publishing to Homebrew (#3507)
    
    * Done
    
    * Autofile PR
    
    * fix readme
    
    Co-authored-by: Ian Joiner <ia...@spaceandtime.io>
---
 dev/release/README.md           |  8 +++-
 dev/release/publish_homebrew.sh | 83 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/dev/release/README.md b/dev/release/README.md
index 06023ce08..e7db35396 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 datafusion
 formula 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.sh
new file mode 100644
index 000000000..876a974e9
--- /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} git@github.com:${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!"