]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/dev/release/01-prepare.sh
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / dev / release / 01-prepare.sh
1 #!/usr/bin/env bash
2 #
3 # Licensed to the Apache Software Foundation (ASF) under one
4 # or more contributor license agreements. See the NOTICE file
5 # distributed with this work for additional information
6 # regarding copyright ownership. The ASF licenses this file
7 # to you under the Apache License, Version 2.0 (the
8 # "License"); you may not use this file except in compliance
9 # with the License. You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing,
14 # software distributed under the License is distributed on an
15 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 # KIND, either express or implied. See the License for the
17 # specific language governing permissions and limitations
18 # under the License.
19 #
20 set -ue
21
22 SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23
24 if [ "$#" -ne 3 ]; then
25 echo "Usage: $0 <version> <next_version> <rc-num>"
26 exit 1
27 fi
28
29 . $SOURCE_DIR/utils-prepare.sh
30
31 version=$1
32 next_version=$2
33 next_version_snapshot="${next_version}-SNAPSHOT"
34 rc_number=$3
35
36 release_tag="apache-arrow-${version}"
37 release_branch="release-${version}"
38 release_candidate_branch="release-${version}-rc${rc_number}"
39
40 : ${PREPARE_DEFAULT:=1}
41 : ${PREPARE_CHANGELOG:=${PREPARE_DEFAULT}}
42 : ${PREPARE_LINUX_PACKAGES:=${PREPARE_DEFAULT}}
43 : ${PREPARE_VERSION_PRE_TAG:=${PREPARE_DEFAULT}}
44 : ${PREPARE_BRANCH:=${PREPARE_DEFAULT}}
45 : ${PREPARE_TAG:=${PREPARE_DEFAULT}}
46
47 if [ ${PREPARE_TAG} -gt 0 ]; then
48 if [ $(git tag -l "${release_tag}") ]; then
49 echo "Delete existing git tag $release_tag"
50 git tag -d "${release_tag}"
51 fi
52 fi
53
54 if [ ${PREPARE_BRANCH} -gt 0 ]; then
55 if [[ $(git branch -l "${release_candidate_branch}") ]]; then
56 next_rc_number=$(($rc_number+1))
57 echo "Branch ${release_candidate_branch} already exists, so create a new release candidate:"
58 echo "1. Checkout the master branch for major releases and maint-<version> for patch releases."
59 echo "2. Execute the script again with bumped RC number."
60 echo "Commands:"
61 echo " git checkout master"
62 echo " dev/release/01-prepare.sh ${version} ${next_version} ${next_rc_number}"
63 exit 1
64 fi
65
66 echo "Create local branch ${release_candidate_branch} for release candidate ${rc_number}"
67 git checkout -b ${release_candidate_branch}
68 fi
69
70 ############################## Pre-Tag Commits ##############################
71
72 if [ ${PREPARE_CHANGELOG} -gt 0 ]; then
73 echo "Updating changelog for $version"
74 # Update changelog
75 archery release changelog add $version
76 git add ${SOURCE_DIR}/../../CHANGELOG.md
77 git commit -m "[Release] Update CHANGELOG.md for $version"
78 fi
79
80 if [ ${PREPARE_LINUX_PACKAGES} -gt 0 ]; then
81 echo "Updating .deb/.rpm changelogs for $version"
82 cd $SOURCE_DIR/../tasks/linux-packages
83 rake \
84 version:update \
85 ARROW_RELEASE_TIME="$(date +%Y-%m-%dT%H:%M:%S%z)" \
86 ARROW_VERSION=${version}
87 git add */debian*/changelog */yum/*.spec.in
88 git commit -m "[Release] Update .deb/.rpm changelogs for $version"
89 cd -
90 fi
91
92 if [ ${PREPARE_VERSION_PRE_TAG} -gt 0 ]; then
93 echo "Prepare release ${version} on tag ${release_tag} then reset to version ${next_version_snapshot}"
94
95 update_versions "${version}" "${next_version}" "release"
96 git commit -m "[Release] Update versions for ${version}"
97 fi
98
99 ############################## Tag the Release ##############################
100
101 if [ ${PREPARE_TAG} -gt 0 ]; then
102 git tag -a "${release_tag}" -m "[Release] Apache Arrow Release ${version}"
103 fi