kou commented on code in PR #280: URL: https://github.com/apache/arrow-cookbook/pull/280#discussion_r1047771088
########## dev/release/utils-prepare.sh: ########## @@ -0,0 +1,70 @@ +# 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}\"/" \ + conf.py + rm -f conf.py.bak + + sed -i.bak -E -e \ + "s/version = \"${next_version}-SNAPSHOT\"/version = \"${nightly_version_snapshot}\"/" \ Review Comment: We can use multiple `-e` in one `sed`: ```suggestion sed -i.bak -E \ -e "s/version = \"${base_version}\"/version = \"${next_version}\"/" \ -e "s/version = \"${next_version}-SNAPSHOT\"/version = \"${nightly_version_snapshot}\"/" \ ``` ########## dev/release/01-prepare.sh: ########## @@ -0,0 +1,55 @@ +#!/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}" + +: ${PREPARE_DEFAULT:=1} +: ${PREPARE_VERSION_PRE_TAG:=${PREPARE_DEFAULT}} +: ${PREPARE_TAG:=${PREPARE_DEFAULT}} + + +if [ ${PREPARE_TAG} -gt 0 ]; then + if [ $(git tag -l "${version_tag}") ]; then + echo "Delete existing git tag $version_tag" + git tag -d "${version_tag}" + fi +fi + +if [ ${PREPARE_VERSION_PRE_TAG} -gt 0 ]; then + echo "Prepare ${new_version} on tag ${version_tag}" + update_versions "${old_version}" "${new_version}" + git commit -m "MINOR: [Release] Update versions for ${new_version}" +fi + +if [ ${PREPARE_TAG} -gt 0 ]; then + git tag -a "${version_tag}" -m "[Release] Apache Arrow Release ${new_version}" Review Comment: How about running this after the update version commit is merged into `main`? ########## dev/release/README.md: ########## @@ -0,0 +1,72 @@ +<!--- + 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-prepare.sh` script with two arguments `current_version` +and `new_version`. + +``` +./dev/release/01-prepare.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. +- Create a tag for the stable Release. +- Commit to the current branch with the updated versions. + +You can push the Release tag: + +``` +git push -u apache apache-arrow-<version> +``` Review Comment: How about pushing this tag after this commit is merged? If this change is rejected, this tag refers nonexistent commit in `main`. ########## dev/release/README.md: ########## @@ -0,0 +1,72 @@ +<!--- + 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-prepare.sh` script with two arguments `current_version` +and `new_version`. + +``` +./dev/release/01-prepare.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. +- Create a tag for the stable Release. +- Commit to the current branch with the updated versions. + +You can push the Release tag: + +``` +git push -u apache apache-arrow-<version> +``` + +And you can create a PR to merge the main branch changes. Review Comment: Note that we can't use "Squash and merge" button for this. Because it changes commit ID that is referred by the above tag. We need to use `git push -u apache main` for the commit. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
