[Release] Update release process for separate Java (#376)
Fixes https://github.com/apache/arrow-cookbook/issues/372.
Also tidies up release README a bit.
diff --git a/dev/release/01-bump-versions.sh b/dev/release/01-bump-versions.sh
index 752b8c0..2af5eca 100755
--- a/dev/release/01-bump-versions.sh
+++ b/dev/release/01-bump-versions.sh
@@ -19,6 +19,11 @@
#
set -ue
+: ${BUMP_DEFAULT:=1}
+: ${BUMP_CPP:=${BUMP_DEFAULT}}
+: ${BUMP_PYTHON:=${BUMP_DEFAULT}}
+: ${BUMP_JAVA:=0}
+
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$#" -ne 2 ]; then
@@ -32,6 +37,18 @@
new_version=$2
version_tag="apache-arrow-${new_version}"
+# Use the BUMP_XYZ vars to create a tag string for the commit
+TAGS=""
+if [ "${BUMP_CPP:-0}" -eq 1 ]; then
+ TAGS="${TAGS}[C++]"
+fi
+if [ "${BUMP_JAVA:-0}" -eq 1 ]; then
+ TAGS="${TAGS}[Java]"
+fi
+if [ "${BUMP_PYTHON:-0}" -eq 1 ]; then
+ TAGS="${TAGS}[Python]"
+fi
+
echo "Prepare ${new_version}"
update_versions "${old_version}" "${new_version}"
-git commit -m "MINOR: [Release] Update versions for ${new_version}"
+git commit -m "MINOR: [Release]$TAGS Update versions for ${new_version}"
diff --git a/dev/release/README.md b/dev/release/README.md
index 4e74da2..0194d98 100644
--- a/dev/release/README.md
+++ b/dev/release/README.md
@@ -19,21 +19,21 @@
# Apache Arrow Cookbook Release update
-The following explains how to update the Cookbooks once a new Release
-of Apache Arrow has been created. At the moment the CPP cookbooks require
-the version of Apache Arrow to be available on conda.
+The following explains how to update the Cookbooks once a new Release of Apache
+Arrow has been created. Note that updating the cookbooks first requires updated
+packages to be available on either conda-forge (C++, Python) or Maven Central
+(Java).
## Requirements
-For the CPP cookbooks we use conda lock files that have to be updated
-when we want to update the version of Arrow used.
+For the C++ cookbooks we use conda lock files that have to be updated when we
+want to update the version of Arrow used.
-The script requires `conda-lock` to be installed.
-As an example you can create a virtual environment with the following
-commands but you can use conda too. The only requirement
-is for `conda-lock` to be available.
+The script requires `conda-lock` to be installed. As an example you can create a
+virtual environment with the following commands but you can use conda too. The
+only requirement is for `conda-lock` to be available.
-```
+```sh
python -m venv cookbook-release
source cookbook-release/bin/activate
pip install conda-lock
@@ -41,25 +41,42 @@
## Usage
-Execute the `01-bump-versions.sh` script with two arguments `current_version`
-and `new_version`.
+By default, the following script only updates the C++ and Python cookbook
+versions because Arrow Java is released and versioned separately.
-```
+To update versions for C++ and Python, execute the `01-bump-versions.sh` script
+with two arguments `current_version` and `new_version`:
+
+```sh
./dev/release/01-bump-versions.sh 10.0.1 11.0.0
```
The script will:
-- Update the version for Java, Python and CPP cookbooks.
+- Update the version for Python and CPP cookbooks.
- Update the conda lock files for the CPP cookbooks.
- Commit to the current branch with the updated versions.
-Now you should create a Pull Request to merge the changes against the main branch.
+To update just versions for Arrow Java, run:
+
+```sh
+BUMP_DEFAULT=0 BUMP_JAVA=1 ./dev/release/01-bump-versions.sh 10.0.1 11.0.0
+```
+
+When run this way, this script will:
+
+The script will:
+
+- Update the version in the `pom.xml` used by the Java Cookbooks.
+- Commit to the current branch with the updated versions.
+
+Either way, after running you should create a Pull Request to merge the changes
+against the main branch.
Once the Pull Request is merged you can run the `02-update.sh` from the updated
main branch. This script requires a single argument with the `new_version`:
-```
+```sh
./dev/release/02-update.sh 11.0.0
```
diff --git a/dev/release/utils-prepare.sh b/dev/release/utils-prepare.sh
index 7942e94..6e04f93 100755
--- a/dev/release/utils-prepare.sh
+++ b/dev/release/utils-prepare.sh
@@ -25,40 +25,46 @@
local nightly_major_version=$(($major_version+1))
local nightly_version_snapshot="${nightly_major_version}.0.0-SNAPSHOT"
- pushd "${ARROW_COOKBOOK_DIR}/java/source/demo"
- mvn versions:set-property -Dproperty=arrow.version -DnewVersion=${next_version}
- find . -type f -name pom.xml.versionsBackup -delete
- git add pom.xml
- popd
+ if [ "${BUMP_JAVA:-0}" -eq 1 ]; then
+ pushd "${ARROW_COOKBOOK_DIR}/java/source/demo"
+ mvn versions:set-property -Dproperty=arrow.version -DnewVersion=${next_version}
+ find . -type f -name pom.xml.versionsBackup -delete
+ git add pom.xml
+ popd
- pushd "${ARROW_COOKBOOK_DIR}/java/source"
- sed -i.bak -E \
- -e "s/version = \"${base_version}\"/version = \"${next_version}\"/" \
- -e "s/version = \"${next_version}-SNAPSHOT\"/version = \"${nightly_version_snapshot}\"/" \
- conf.py
- rm -f conf.py.bak
- git add conf.py
- popd
+ pushd "${ARROW_COOKBOOK_DIR}/java/source"
+ sed -i.bak -E \
+ -e "s/version = \"${base_version}\"/version = \"${next_version}\"/" \
+ -e "s/version = \"${next_version}-SNAPSHOT\"/version = \"${nightly_version_snapshot}\"/" \
+ conf.py
+ rm -f conf.py.bak
+ git add conf.py
+ popd
+ fi
- pushd "${ARROW_COOKBOOK_DIR}/python"
- sed -i.bak -E -e \
- "s/pyarrow==${base_version}/pyarrow==${next_version}/" \
- requirements.txt
- rm -f requirements.txt.bak
- git add requirements.txt
- popd
+ if [ "${BUMP_PYTHON:-0}" -eq 1 ]; then
+ pushd "${ARROW_COOKBOOK_DIR}/python"
+ sed -i.bak -E -e \
+ "s/pyarrow==${base_version}/pyarrow==${next_version}/" \
+ requirements.txt
+ rm -f requirements.txt.bak
+ git add requirements.txt
+ popd
+ fi
- pushd "${ARROW_COOKBOOK_DIR}/cpp"
- sed -i.bak -E \
- -e "s/libarrow(-?[a-z]*)==${base_version}/libarrow\1==${next_version}/" \
- -e "s/pyarrow==${base_version}/pyarrow==${next_version}/" \
- environment.yml
- rm -f environment.yml.bak
+ if [ "${BUMP_CPP:-0}" -eq 1 ]; then
+ pushd "${ARROW_COOKBOOK_DIR}/cpp"
+ sed -i.bak -E \
+ -e "s/libarrow(-?[a-z]*)==${base_version}/libarrow\1==${next_version}/" \
+ -e "s/pyarrow==${base_version}/pyarrow==${next_version}/" \
+ environment.yml
+ rm -f environment.yml.bak
- conda-lock --file environment.yml --kind explicit -p linux-aarch64 -p linux-64 -p osx-arm64
- git add environment.yml
- git add conda-linux-64.lock
- git add conda-linux-aarch64.lock
- git add conda-osx-arm64.lock
- popd
+ conda-lock --file environment.yml --kind explicit -p linux-aarch64 -p linux-64 -p osx-arm64
+ git add environment.yml
+ git add conda-linux-64.lock
+ git add conda-linux-aarch64.lock
+ git add conda-osx-arm64.lock
+ popd
+ fi
}