[Release] Update post release tasks for cookbooks (#280)

* [Release] Update post release tasks for cookbooks

* Remove requirements.txt and explain on README that conda-lock must be available

* Review comment suggestion

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

* Split process into two scripts. One to update versions and one to regenerate stable branch and tag

* Apply suggestions from code review

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
diff --git a/cpp/environment.yml b/cpp/environment.yml
index 826d16b..eae4ba8 100644
--- a/cpp/environment.yml
+++ b/cpp/environment.yml
@@ -20,9 +20,9 @@
 dependencies:
   - python=3.9
   - compilers
-  - arrow-cpp >=10,<11
+  - arrow-cpp==10.0.1
   - sphinx
   - gtest
   - gmock
-  - pyarrow >=10,<11
+  - pyarrow==10.0.1
   - clang-tools
diff --git a/dev/release/01-bump-versions.sh b/dev/release/01-bump-versions.sh
new file mode 100755
index 0000000..752b8c0
--- /dev/null
+++ b/dev/release/01-bump-versions.sh
@@ -0,0 +1,37 @@
+#!/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
+
+SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+if [ "$#" -ne 2 ]; then
+  echo "Usage: $0 <old_version> <new_version>"
+  exit 1
+fi
+
+. $SOURCE_DIR/utils-prepare.sh
+
+old_version=$1
+new_version=$2
+version_tag="apache-arrow-${new_version}"
+
+echo "Prepare ${new_version}"
+update_versions "${old_version}" "${new_version}"
+git commit -m "MINOR: [Release] Update versions for ${new_version}"
diff --git a/dev/release/02-update.sh b/dev/release/02-update.sh
new file mode 100755
index 0000000..d9e724e
--- /dev/null
+++ b/dev/release/02-update.sh
@@ -0,0 +1,58 @@
+#!/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 1 ]; then
+  echo "Usage: $0 <new_version>"
+  exit 1
+fi
+
+new_version=$1
+version_tag="apache-arrow-${new_version}"
+current_branch=$(git branch --show-current)
+
+if [ ${current_branch} != "main" ]; then
+    echo "You should create a tag and update stable from the main branch instead of ${current_branch}:"
+    echo "1. Checkout the default branch and pull the latest changes."
+    echo "Commands:"
+    echo "   git checkout main"
+    echo "   git pull"
+    echo "   dev/release/02-update.sh ${new_version}"
+    exit 1
+fi
+
+if [ "$(git branch -l "stable")" != "" ]; then
+    echo "Removing old stable branch locally and remotely"
+    git branch -d stable
+    git push -u apache --delete stable
+fi
+
+echo "Creating and pushing new stable branch from main"
+git branch stable
+git push -u apache stable
+
+if [ "$(git tag -l "${version_tag}")" != "" ]; then
+  echo "Delete existing git tag $version_tag"
+  git tag -d "${version_tag}"
+fi
+
+echo "Creating tag ${version_tag} for ${new_version}"
+git tag -a "${version_tag}" -m "[Release] Apache Arrow Release ${new_version}"
+git push -u apache ${version_tag}
diff --git a/dev/release/README.md b/dev/release/README.md
new file mode 100644
index 0000000..4e74da2
--- /dev/null
+++ b/dev/release/README.md
@@ -0,0 +1,71 @@
+<!---
+  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.
+-->
+
+# 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.
+
+## 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.
+
+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.
+
+```
+python -m venv cookbook-release
+source cookbook-release/bin/activate
+pip install conda-lock
+```
+
+## Usage
+
+Execute the `01-bump-versions.sh` script with two arguments `current_version`
+and `new_version`.
+
+```
+./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 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.
+
+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`:
+
+```
+./dev/release/02-update.sh 11.0.0
+```
+
+The script will:
+
+- Regenerate the stable branch from main. Take into account that this will
+  delete and create a new stable branch.
+- Create a tag for the stable Release.
+- Push both the new stable branch and the tag.
diff --git a/dev/release/utils-prepare.sh b/dev/release/utils-prepare.sh
new file mode 100755
index 0000000..0101beb
--- /dev/null
+++ b/dev/release/utils-prepare.sh
@@ -0,0 +1,64 @@
+# 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.
+
+ARROW_COOKBOOK_DIR="${SOURCE_DIR}/../.."
+
+update_versions() {
+  local base_version=$1
+  local next_version=$2
+
+  local major_version=${next_version%%.*}
+  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
+
+  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}/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
+
+  pushd "${ARROW_COOKBOOK_DIR}/cpp"
+  sed -i.bak -E \
+    -e "s/arrow-cpp==${base_version}/arrow-cpp==${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
+}
diff --git a/java/source/conf.py b/java/source/conf.py
index 7ba4fa4..81178ae 100644
--- a/java/source/conf.py
+++ b/java/source/conf.py
@@ -40,7 +40,7 @@
 if arrow_nightly and arrow_nightly != '0':
     version = "11.0.0-SNAPSHOT"
 else:
-    version = "10.0.0"
+    version = "10.0.1"
 print(f"Running with Arrow version: {version}")
 
 # -- General configuration ---------------------------------------------------
diff --git a/java/source/demo/pom.xml b/java/source/demo/pom.xml
index 166b7b1..bd4036f 100644
--- a/java/source/demo/pom.xml
+++ b/java/source/demo/pom.xml
@@ -34,7 +34,7 @@
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
-        <arrow.version>10.0.0</arrow.version>
+        <arrow.version>10.0.1</arrow.version>
     </properties>
     <dependencies>
         <dependency>
diff --git a/python/requirements.txt b/python/requirements.txt
index 7ceac2e..8d2a3f0 100644
--- a/python/requirements.txt
+++ b/python/requirements.txt
@@ -1,3 +1,3 @@
 Sphinx>=4.0.2
-pyarrow==10.0.0
+pyarrow==10.0.1
 pandas>=1.2.5