Skip to content

Apache DataFusion SQL Query Engine

Add `release-crates.sh` script (#5070)

Ian Alexander Joinere24a7ecc6ff4
diff --git a/dev/release/README.md b/dev/release/README.md
index ce9467fec3..940770b906 100644
--- a/dev/release/README.md
+++ b/dev/release/README.md
@@ -286,8 +286,12 @@ of the following crates:
Download and unpack the official release tarball
Verify that the Cargo.toml in the tarball contains the correct version
-(e.g. `version = "5.1.0"`) and then publish the crates with the
-following commands. Crates need to be published in the correct order as shown in this diagram.
+(e.g. `version = "5.1.0"`) and then publish the crates by running the script `release-crates.sh`
+in a directory extracted from the source tarball that was voted on. Note that this script doesn't
+work if run in a Git repo.
+
+Alternatively the crates can be published one at a time with the following commands. Crates need to be
+published in the correct order as shown in this diagram.
![](crate-deps.svg)
diff --git a/dev/release/release-crates.sh b/dev/release/release-crates.sh
new file mode 100644
index 0000000000..7acd9eb950
--- /dev/null
+++ b/dev/release/release-crates.sh
@@ -0,0 +1,45 @@
+#!/bin/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.
+#
+
+# This script publishes datafusion crates to crates.io.
+#
+# This script should only be run after the release has been approved
+# by the arrow PMC committee.
+#
+# See release/README.md for full release instructions
+
+set -eu
+
+# Do not run inside a git repo
+if ! [ git rev-parse --is-inside-work-tree ]; then
+ cd datafusion/common && cargo publish
+ cd datafusion/expr && cargo publish
+ cd datafusion/sql && cargo publish
+ cd datafusion/jit && cargo publish
+ cd datafusion/row && cargo publish
+ cd datafusion/physical-expr && cargo publish
+ cd datafusion/optimizer && cargo publish
+ cd datafusion/core && cargo publish
+ cd datafusion/proto && cargo publish
+ cd datafusion-cli && cargo publish --no-verify
+else
+ echo "Crates must be released from the source tarball that was voted on, not from the repo"
+ exit 1
+fi