|
| 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 | + |
| 21 | +set -e |
| 22 | + |
| 23 | +if [[ $# -lt 2 ]]; then |
| 24 | + echo "Usage: $0 \$VERSION \$WORKFLOW_ID" |
| 25 | + exit 1 |
| 26 | +fi |
| 27 | +if [[ ! $GITHUB_TOKEN ]]; then |
| 28 | + echo "GITHUB_TOKEN (must have the actions scope) is not set" |
| 29 | + exit 2 |
| 30 | +fi |
| 31 | + |
| 32 | +VERSION=$1 |
| 33 | +TAG=v$VERSION |
| 34 | +WORKFLOW_ID=$2 |
| 35 | + |
| 36 | +# Download the source tar |
| 37 | +curl -O -L https://github.com/apache/pulsar-client-python/archive/refs/tags/$TAG.tar.gz |
| 38 | +mv $TAG.tar.gz pulsar-client-python-$VERSION.tar.gz |
| 39 | + |
| 40 | +# Download the Python wheels |
| 41 | +URLS=$(curl -L https://api.github.com/repos/apache/pulsar-client-python/actions/runs/$WORKFLOW_ID/artifacts \ |
| 42 | + | jq '.artifacts[] .archive_download_url' | sed 's/^"\(.*\)"$/\1/') |
| 43 | +for URL in $URLS; do |
| 44 | + curl -O -L $URL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" |
| 45 | + unzip -q zip |
| 46 | + rm -f zip |
| 47 | +done |
| 48 | + |
| 49 | +sign() { |
| 50 | + FILE=$1 |
| 51 | + gpg --armor --output $FILE.asc --detach-sig $FILE |
| 52 | + shasum -a 512 $FILE > $FILE.sha512 |
| 53 | +} |
| 54 | + |
| 55 | +export GPG_TTY=$(tty) |
| 56 | +set -x |
| 57 | +for WHEEL in $(ls *.whl); do |
| 58 | + sign $WHEEL |
| 59 | +done |
| 60 | +sign pulsar-client-python-$VERSION.tar.gz |
| 61 | + |
| 62 | +mkdir windows && cd windows |
| 63 | +mv ../pulsar_client*win*.whl* . && cd .. |
| 64 | + |
| 65 | +mkdir macos && cd macos |
| 66 | +mv ../pulsar_client*macos*.whl* . && cd .. |
| 67 | + |
| 68 | +mkdir linux-glibc-x86_64 && cd linux-glibc-x86_64 |
| 69 | +mv ../pulsar_client*manylinux*x86_64.whl* . && cd .. |
| 70 | + |
| 71 | +mkdir linux-glibc-arm64 && cd linux-glibc-arm64 |
| 72 | +mv ../pulsar_client*manylinux*aarch64.whl* . && cd .. |
| 73 | + |
| 74 | +mkdir linux-musl-x86_64 && cd linux-musl-x86_64 |
| 75 | +mv ../pulsar_client*musllinux*x86_64.whl* . && cd .. |
| 76 | + |
| 77 | +mkdir linux-musl-arm64 && cd linux-musl-arm64 |
| 78 | +mv ../pulsar_client*musllinux*aarch64.whl* . && cd .. |
0 commit comments