|
| 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, software |
| 14 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +# See the License for the specific language governing permissions and |
| 17 | +# limitations under the License. |
| 18 | + |
| 19 | +# Script that assembles all you need to make an RC. Does build of the tar.gzs |
| 20 | +# which it stashes into a dir above $(pwd) named for the script with a |
| 21 | +# timestamp suffix. Deploys builds to maven. |
| 22 | +# |
| 23 | +# To finish, check what was build. If good, copy to dist.apache.org/dev and |
| 24 | +# close the maven repos. Call a vote. |
| 25 | +# |
| 26 | +# Presumes your settings.xml all set up so can sign artifacts published to mvn, etc. |
| 27 | + |
| 28 | +set -e |
| 29 | + |
| 30 | +# Script checks out a tag, cleans the checkout and then builds src and bin |
| 31 | +# tarballs. It then deploys to the apache maven repository. |
| 32 | +# Presumes run from git dir. |
| 33 | + |
| 34 | +# Need a git tag to build. |
| 35 | +if [ "$1" = "" ] |
| 36 | +then |
| 37 | + echo -n "Usage: $0 TAG_TO_PACKAGE" |
| 38 | + exit 1 |
| 39 | +fi |
| 40 | +git_tag=$1 |
| 41 | + |
| 42 | +# Set mvn |
| 43 | +mvn=mvn |
| 44 | +if [ "$MAVEN" != "" ]; then |
| 45 | + mvn="${MAVEN}" |
| 46 | +fi |
| 47 | + |
| 48 | +# Ensure we are inside a git repo before making progress |
| 49 | +# The below will fail if outside git. |
| 50 | +git -C . rev-parse |
| 51 | + |
| 52 | +# Checkout git_tag |
| 53 | +git checkout "${git_tag}" |
| 54 | + |
| 55 | +# Get mvn project version |
| 56 | +#shellcheck disable=SC2016 |
| 57 | +version=$(${mvn} -q -N -Dexec.executable="echo" -Dexec.args='${project.version}' exec:exec) |
| 58 | +hbase_name="hbase-thirdparty-${version}" |
| 59 | + |
| 60 | +# Make a dir to save tgzs into. |
| 61 | +d=`date -u +"%Y%m%dT%H%M%SZ"` |
| 62 | +output_dir="${TMPDIR}/$hbase_name.$d" |
| 63 | +mkdir -p "${output_dir}" |
| 64 | + |
| 65 | +# Make sure all clean. |
| 66 | +git clean -f -x -d |
| 67 | +${mvn} clean |
| 68 | + |
| 69 | +# Run a rat check. |
| 70 | +${mvn} apache-rat:check |
| 71 | + |
| 72 | +# Build src. |
| 73 | +git archive --format=tar.gz --output="${output_dir}/${hbase_name}-src.tar.gz" --prefix="${hbase_name}/" "${git_tag}" |
| 74 | + |
| 75 | +# Deploy to mvn repository |
| 76 | +${mvn} clean deploy -Papache-release -Prelease |
| 77 | + |
| 78 | +# Do sha512 |
| 79 | +cd ${output_dir} |
| 80 | +for i in *.tar.gz; do echo $i; gpg --print-md SHA512 $i > $i.sha512 ; done |
| 81 | + |
| 82 | +echo "Check the content of ${output_dir}. If good, sign and push to dist.apache.org/dev" |
| 83 | +echo " e.g. gpg --armor --output ${hbase_name}-src.tar.gz.asc --detach-sig ${hbase_name}-src.tar.gz " |
| 84 | +echo "Also, check the content deployed to maven. If good, close the repo and record links of temporary staging repo" |
0 commit comments