forked from apache/pulsar-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstage-release.sh
More file actions
executable file
·109 lines (92 loc) · 3.16 KB
/
Copy pathstage-release.sh
File metadata and controls
executable file
·109 lines (92 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
set -e
if [[ $# -lt 2 ]]; then
echo "Usage: $0 \$VERSION \$WORKFLOW_ID"
echo "Example: $0 3.12.0-candidate-0 25781230226"
exit 1
fi
if [[ ! $GITHUB_TOKEN ]]; then
echo "GITHUB_TOKEN (must have the actions scope) is not set"
exit 2
fi
VERSION=$1
TAG=v$VERSION
WORKFLOW_ID=$2
# Download the source tar
curl --fail --location --remote-name \
https://github.com/apache/pulsar-client-python/archive/refs/tags/$TAG.tar.gz
# Remove the "-candidate-N" suffix
VERSION=$(echo $VERSION | sed 's/-candidate-.*//')
mv $TAG.tar.gz pulsar-client-python-$VERSION.tar.gz
# Download the Python wheels
ARTIFACTS_API=https://api.github.com/repos/apache/pulsar-client-python/actions/runs/$WORKFLOW_ID/artifacts
URLS=()
PAGE=1
while true; do
RESPONSE=$(curl --fail --silent --show-error --location \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
"$ARTIFACTS_API?per_page=100&page=$PAGE")
while IFS= read -r URL; do
[[ -n $URL ]] && URLS+=("$URL")
done < <(jq -r '.artifacts[]
| select(((.name // "") | contains("dockerbuild")) | not)
| .archive_download_url' <<< "$RESPONSE")
if [[ $(jq '.artifacts | length' <<< "$RESPONSE") -lt 100 ]]; then
break
fi
PAGE=$((PAGE + 1))
done
if [[ ${#URLS[@]} -eq 0 ]]; then
echo "No wheel artifacts found for workflow run $WORKFLOW_ID"
exit 3
fi
for URL in "${URLS[@]}"; do
curl --fail --location --output zip \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
"$URL"
unzip -oq zip
rm -f zip
done
sign() {
FILE=$1
gpg --armor --output $FILE.asc --detach-sig $FILE
shasum -a 512 $FILE > $FILE.sha512
}
export GPG_TTY=$(tty)
set -x
for WHEEL in $(ls *.whl); do
sign $WHEEL
done
sign pulsar-client-python-$VERSION.tar.gz
mkdir windows && cd windows
mv ../pulsar_client*win*.whl* . && cd ..
mkdir macos && cd macos
mv ../pulsar_client*macos*.whl* . && cd ..
mkdir linux-glibc-x86_64 && cd linux-glibc-x86_64
mv ../pulsar_client*manylinux*x86_64.whl* . && cd ..
mkdir linux-glibc-arm64 && cd linux-glibc-arm64
mv ../pulsar_client*manylinux*aarch64.whl* . && cd ..
mkdir linux-musl-x86_64 && cd linux-musl-x86_64
mv ../pulsar_client*musllinux*x86_64.whl* . && cd ..
mkdir linux-musl-arm64 && cd linux-musl-arm64
mv ../pulsar_client*musllinux*aarch64.whl* . && cd ..