cwsteinbach commented on a change in pull request #2938:
URL: https://github.com/apache/iceberg/pull/2938#discussion_r686175444
##########
File path: dev/source-release.sh
##########
@@ -20,72 +20,137 @@
set -e
-if [ -z "$1" ]; then
- echo "Usage: $0 <version-num> <rc-num>"
- exit
-fi
-
-if [ -z "$2" ]; then
- echo "Usage: $0 <version-num> <rc-num>"
- exit
+usage () {
+ echo "usage: $0 [-k <key_id>] [-r <git_remote>] <version_num> <rc_num>"
+ echo " -k Specify signing key. Defaults to \"GPG default key\""
+ echo " -r Specify Git remote name. Defaults to \"origin\""
+ echo " -d Turn on DEBUG output"
+ exit 1
+}
+
+# Default repository remote name
+remote="origin"
+
+while getopts "k:r:d" opt; do
+ case "${opt}" in
+ k)
+ keyid="${OPTARG}"
+ ;;
+ r)
+ remote="${OPTARG}"
+ ;;
+ d)
+ set -x
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
+
+version="$1"
+rc="$2"
+
+if [ -z "$version" ] || [ -z "$rc" ]; then
+ usage
fi
-version=$1
-rc=$2
+scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+projectdir="$(dirname "$scriptdir")"
+tmpdir=$projectdir/tmp
-if [ -d tmp/ ]; then
- echo "Cannot run: tmp/ exists"
- exit
+if [ -d $tmpdir ]; then
+ echo "Cannot run: $tmpdir already exists"
+ exit 1
fi
-tag=apache-iceberg-$version
-tagrc=${tag}-rc${rc}
+tag="apache-iceberg-$version"
+tagrc="${tag}-rc${rc}"
echo "Preparing source for $tagrc"
-# create version.txt for this release
-echo $version > version.txt
-git add version.txt
-git commit -m "Add version.txt for release $version" version.txt
+echo "Adding version.txt and tagging release..."
+echo $version > $projectdir/version.txt
+git add $projectdir/version.txt
+git commit -m "Add version.txt for release $version" $projectdir/version.txt
set_version_hash=`git rev-list HEAD 2> /dev/null | head -n 1 `
-
git tag -am "Apache Iceberg $version" $tagrc $set_version_hash
-git push apache $tagrc
+
+echo "Pushing $tagrc to $remote..."
+git push $remote $tagrc
release_hash=`git rev-list $tagrc 2> /dev/null | head -n 1 `
if [ -z "$release_hash" ]; then
- echo "Cannot continue: unknown git tag: $tag"
+ echo "Cannot continue: unknown Git tag: $tag"
exit
fi
-echo "Using commit $release_hash"
-
-tarball=$tag.tar.gz
-
# be conservative and use the release hash, even though git produces the same
# archive (identical hashes) using the scm tag
-git archive $release_hash --worktree-attributes --prefix $tag/ -o $tarball
+echo "Creating tarball ${tarball} using commit $release_hash"
+tarball=$tag.tar.gz
+git archive $release_hash --worktree-attributes --prefix $tag/ -o
$projectdir/$tarball
+
+echo "Signing the tarball..."
+[[ -z "$keyid" ]] && keyopt="-u $keyid"
+gpg --detach-sig $keyopt --armor --output ${projectdir}/${tarball}.asc
${projectdir}/$tarball
+sha512sum ${projectdir}/$tarball > ${projectdir}/${tarball}.sha512
Review comment:
I agree that it's overkill for this script.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]