|
| 1 | +#!/bin/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 -e |
| 21 | + |
| 22 | +SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 23 | + |
| 24 | +if [ "$#" -ne 2 ]; then |
| 25 | + echo "Usage: $0 <js-version> <rc-num>" |
| 26 | + exit |
| 27 | +fi |
| 28 | + |
| 29 | +js_version=$1 |
| 30 | +rc=$2 |
| 31 | + |
| 32 | +tag=apache-arrow-js-${js_version} |
| 33 | +tagrc=${tag}-rc${rc} |
| 34 | + |
| 35 | +echo "Preparing source for tag ${tag}" |
| 36 | + |
| 37 | +tarball=${tag}.tar.gz |
| 38 | + |
| 39 | +# cd to $ARROW_HOME/js |
| 40 | +cd $SOURCE_DIR/../../js |
| 41 | +JS_SRC_DIR="$PWD" |
| 42 | +# npm pack the js source files |
| 43 | +npm install |
| 44 | + |
| 45 | +npm version --no-git-tag-version $js_version |
| 46 | +git add package.json |
| 47 | +git commit -m "[Release] Apache Arrow JavaScript $js_version" |
| 48 | +git tag -a ${tag} |
| 49 | + |
| 50 | +release_hash=`git rev-list $tag 2> /dev/null | head -n 1 ` |
| 51 | + |
| 52 | +if [ -z "$release_hash" ]; then |
| 53 | + echo "Cannot continue: unknown git tag: $tag" |
| 54 | + exit |
| 55 | +fi |
| 56 | + |
| 57 | +echo "Using commit $release_hash" |
| 58 | + |
| 59 | +cd $SOURCE_DIR |
| 60 | + |
| 61 | +rm -rf js-tmp |
| 62 | +# `npm pack` writes the .tgz file to the current dir, so cd into js-tmp |
| 63 | +mkdir -p js-tmp |
| 64 | +cd js-tmp |
| 65 | +# run npm pack on `arrow/js` |
| 66 | +npm pack ${JS_SRC_DIR} |
| 67 | +# unzip and remove the npm pack tarball |
| 68 | +tar -xzf *.tgz && rm *.tgz |
| 69 | +# `npm pack` puts files in a dir called "package" |
| 70 | +cp $JS_SRC_DIR/../NOTICE.txt package |
| 71 | +cp $JS_SRC_DIR/../LICENSE.txt package |
| 72 | +# rename "package" to $tag |
| 73 | +mv package ${tag} |
| 74 | +tar czf ${tarball} ${tag} |
| 75 | +rm -rf ${tag} |
| 76 | + |
| 77 | +${SOURCE_DIR}/run-rat.sh ${tarball} |
| 78 | + |
| 79 | +# sign the archive |
| 80 | +gpg --armor --output ${tarball}.asc --detach-sig ${tarball} |
| 81 | +gpg --print-md MD5 ${tarball} > ${tarball}.md5 |
| 82 | +sha1sum $tarball > ${tarball}.sha1 |
| 83 | +sha256sum $tarball > ${tarball}.sha256 |
| 84 | +sha512sum $tarball > ${tarball}.sha512 |
| 85 | + |
| 86 | +# check out the arrow RC folder |
| 87 | +svn co --depth=empty https://dist.apache.org/repos/dist/dev/arrow js-rc-tmp |
| 88 | + |
| 89 | +# add the release candidate for the tag |
| 90 | +mkdir -p js-rc-tmp/${tagrc} |
| 91 | +cp ${tarball}* js-rc-tmp/${tagrc} |
| 92 | +svn add js-rc-tmp/${tagrc} |
| 93 | +svn ci -m 'Apache Arrow JavaScript ${version} RC${rc}' js-rc-tmp/${tagrc} |
| 94 | + |
| 95 | +cd - |
| 96 | + |
| 97 | +# clean up |
| 98 | +rm -rf js-tmp |
| 99 | + |
| 100 | +echo "Success! The release candidate is available here:" |
| 101 | +echo " https://dist.apache.org/repos/dist/dev/arrow/${tagrc}" |
| 102 | +echo "" |
| 103 | +echo "Commit SHA1: ${release_hash}" |
0 commit comments