1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+
18+ set -e
19+ set -u
20+ set -o pipefail
21+
22+ SOURCE_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
23+
24+ if [ $# -ne 2 ]; then
25+ echo " Usage: $0 <version> <rc-num>"
26+ exit
27+ fi
28+
29+ version=$1
30+ rc=$2
31+ version_with_rc=${version} -rc${rc}
32+
33+ : ${UPLOAD_DEFAULT=1}
34+ : ${UPLOAD_FORCE_SIGN=${UPLOAD_DEFAULT} }
35+
36+ if [ ${UPLOAD_FORCE_SIGN} -gt 0 ]; then
37+ pushd " ${SOURCE_DIR} "
38+ if [ ! -f .env ]; then
39+ echo " You must create $( pwd) /.env"
40+ echo " You can use $( pwd) /.env.example as template"
41+ exit 1
42+ fi
43+ . .env
44+ popd
45+ fi
46+
47+ version_with_rc=" ${version} -rc${rc} "
48+ crossbow_job_prefix=" release-${version_with_rc} "
49+ crossbow_package_dir=" ${SOURCE_DIR} /../../packages"
50+
51+ : ${CROSSBOW_JOB_NUMBER:= " 0" }
52+ : ${CROSSBOW_JOB_ID:= " ${crossbow_job_prefix} -${CROSSBOW_JOB_NUMBER} " }
53+ : ${ARROW_ARTIFACTS_DIR:= " ${crossbow_package_dir} /${CROSSBOW_JOB_ID} /matlab" }
54+
55+ if [ ! -e " ${ARROW_ARTIFACTS_DIR} " ]; then
56+ echo " ${ARROW_ARTIFACTS_DIR} does not exist"
57+ exit 1
58+ fi
59+
60+ if [ ! -d " ${ARROW_ARTIFACTS_DIR} " ]; then
61+ echo " ${ARROW_ARTIFACTS_DIR} is not a directory"
62+ exit 1
63+ fi
64+
65+ pushd " ${ARROW_ARTIFACTS_DIR} "
66+
67+ if [ ${UPLOAD_FORCE_SIGN} -gt 0 ]; then
68+ # Upload the MATLAB MLTBX Release Candidate to the GitHub Releases
69+ # area of the Apache Arrow GitHub project.
70+ mltbx_file=matlab-arrow-${version_with_rc} .mltbx
71+ mltbx_signature_gpg_ascii_armor=${mltbx_file} .asc
72+ mltbx_checksum_sha512=${mltbx_file} .sha512
73+
74+ rm -rf ${mltbx_signature_gpg_ascii_armor}
75+ rm -rf ${mltbx_checksum_sha512}
76+
77+ # Sign the MLTBX file and create a detached (--deatch-sign) ASCII armor (--armor) GPG signature file.
78+ gpg --detach-sign --local-user " ${GPG_KEY_ID} " --armor ${mltbx_file}
79+
80+ # Compute the SHA512 checksum of the MLTBX file.
81+ shasum --algorithm 512 ${mltbx_file} > ${mltbx_checksum_sha512}
82+ fi
83+
84+ gh release upload ${tag} \
85+ --clobber \
86+ --repo apache/arrow \
87+ *
88+
89+ popd
0 commit comments