Skip to content

Commit e55af90

Browse files
committed
GH-529: [Release] Add support for uploading binary artifacts to repository.apache.org
Fixes GH-529.
1 parent aee890f commit e55af90

File tree

4 files changed

+150
-20
lines changed

4 files changed

+150
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/apache-arrow-java-*
1717
/apache-arrow-java.tar.gz
1818
/build/
19+
/dev/release/.env
1920
/dev/release/apache-rat-0.16.1.jar
2021
/dev/release/filtered_rat.txt
2122
/dev/release/rat.xml

dev/release/.env.example

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
# The GPG key ID to sign artifacts. The GPG key ID must be registered
19+
# to both of the followings:
20+
#
21+
# * https://dist.apache.org/repos/dist/dev/arrow/KEYS
22+
# * https://dist.apache.org/repos/dist/release/arrow/KEYS
23+
#
24+
# See these files how to import your GPG key ID to these files.
25+
#
26+
# You must set this.
27+
#GPG_KEY_ID=08D3564B7C6A9CAFBFF6A66791D18FCF079F8007

dev/release/README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,13 @@ RC without merging the pull request, the script to cut a RC is failed.
5656

5757
### Prepare RC and vote
5858

59-
Run `dev/release/release_rc.sh` on a working copy of
60-
`git@github.com:apache/arrow-java` not your fork:
61-
62-
```console
63-
$ git clone git@github.com:apache/arrow-java.git
64-
$ cd arrow-java
65-
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release_rc.sh ${RC}
66-
(Send a vote email to dev@arrow.apache.org.
67-
You can use a draft shown by release_rc.sh for the email.)
68-
```
69-
70-
Here is an example to release RC1:
71-
72-
```console
73-
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release_rc.sh 1
74-
```
75-
76-
The argument of `release_rc.sh` is the RC number. If RC1 has a
77-
problem, we'll increment the RC number such as RC2, RC3 and so on.
59+
You can use `dev/release/release_rc.sh`.
7860

7961
Requirements to run `release_rc.sh`:
8062

8163
* You must be an Apache Arrow committer or PMC member
8264
* You must prepare your PGP key for signing
65+
* You must configure Maven
8366

8467
If you don't have a PGP key,
8568
https://infra.apache.org/release-signing.html#generate may be helpful.
@@ -102,6 +85,37 @@ $ head KEYS
10285
$ svn ci KEYS
10386
```
10487

88+
Configure Maven to publish artifacts to Apache repositories. You will
89+
need to setup a master password at `~/.m2/settings-security.xml` and
90+
`~/.m2/settings.xml` as specified on [the Apache
91+
guide](https://infra.apache.org/publishing-maven-artifacts.html). It
92+
can be tested with the following command:
93+
94+
```bash
95+
# You might need to export GPG_TTY=$(tty) to properly prompt for a passphrase
96+
mvn clean install -Papache-release
97+
```
98+
99+
Run `dev/release/release_rc.sh` on a working copy of
100+
`git@github.com:apache/arrow-java` not your fork:
101+
102+
```console
103+
$ git clone git@github.com:apache/arrow-java.git
104+
$ cd arrow-java
105+
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release_rc.sh ${RC}
106+
(Send a vote email to dev@arrow.apache.org.
107+
You can use a draft shown by release_rc.sh for the email.)
108+
```
109+
110+
Here is an example to release RC1:
111+
112+
```console
113+
$ GH_TOKEN=${YOUR_GITHUB_TOKEN} dev/release/release_rc.sh 1
114+
```
115+
116+
The argument of `release_rc.sh` is the RC number. If RC1 has a
117+
problem, we'll increment the RC number such as RC2, RC3 and so on.
118+
105119
### Publish
106120

107121
We need to do the followings to publish a new release:

dev/release/release_rc.sh

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ artifacts_dir="apache-arrow-java-${version}-rc${rc}"
8484
signed_artifacts_dir="${artifacts_dir}-signed"
8585

8686
if [ "${RELEASE_SIGN}" -gt 0 ]; then
87+
if [ ! -f "${SOURCE_DIR}/.env" ]; then
88+
echo "You must create ${SOURCE_DIR}/.env"
89+
echo "You can use ${SOURCE_DIR}/.env.example as template"
90+
exit 1
91+
fi
92+
. "${SOURCE_DIR}/.env"
93+
8794
git_origin_url="$(git remote get-url origin)"
8895
repository="${git_origin_url#*github.com?}"
8996
repository="${repository%.git}"
@@ -120,21 +127,102 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
120127
continue
121128
;;
122129
esac
123-
gpg --armor \
130+
gpg \
131+
--armor \
124132
--detach-sig \
133+
--local-user "${GPG_KEY_ID}" \
125134
--output "${signed_artifacts_dir}/$(basename "${artifact}").asc" \
126135
"${artifact}"
127136
done
128137
fi
129138

139+
# arrow-c-data-18.2.0-sources.jar ->
140+
# jar
141+
extract_type() {
142+
local path="$1"
143+
echo "${path}" | grep -o "[^.]*$"
144+
}
145+
146+
# arrow-c-data-18.2.0-sources.jar arrow-c-data-18.2.0 ->
147+
# sources
148+
extract_classifier() {
149+
local path="$1"
150+
local base="$2"
151+
basename "${path}" | sed -e "s/^${base}-//g" -e "s/\.[^.]*$//g"
152+
}
153+
130154
if [ "${RELEASE_UPLOAD}" -gt 0 ]; then
131155
echo "Uploading signature"
132156
gh release upload "${rc_tag}" \
133157
--clobber \
134158
--repo "${repository}" \
135159
"${signed_artifacts_dir}"/*.asc
160+
161+
echo "Uploading packages"
162+
for pom in "${artifacts_dir}"/*.pom; do
163+
base=$(basename "${pom}" .pom)
164+
files=()
165+
types=()
166+
classifiers=()
167+
args=()
168+
args+=(deploy:deploy-file)
169+
args+=(-Durl=https://repository.apache.org/service/local/staging/deploy/maven2)
170+
args+=(-DrepositoryId=apache.releases.https)
171+
args+=(-DpomFile="${pom}")
172+
if [ -f "${artifacts_dir}/${base}.jar" ]; then
173+
jar="${artifacts_dir}/${base}.jar"
174+
args+=(-Dfile="${jar}")
175+
files+=("${signed_artifacts_dir}/${base}.jar.asc")
176+
types+=("jar.asc")
177+
classifiers+=("")
178+
else
179+
args+=(-Dfile="${pom}")
180+
fi
181+
files+=("${signed_artifacts_dir}/${base}.pom.asc")
182+
types+=("pom.asc")
183+
classifiers+=("")
184+
if [ "$(echo "${artifacts_dir}/${base}"-*)" != "${artifacts_dir}/${base}-*" ]; then
185+
for other_file in "${artifacts_dir}/${base}"-*; do
186+
type="$(extract_type "${other_file}")"
187+
case "${type}" in
188+
sha256 | sha512)
189+
continue
190+
;;
191+
esac
192+
classifier=$(extract_classifier "${other_file}" "${base}")
193+
files+=("${other_file}")
194+
types+=("${type}")
195+
classifiers+=("${classifier}")
196+
other_file_base="$(basename "${other_file}")"
197+
files+=("${signed_artifacts_dir}/${other_file_base}.asc")
198+
types+=("${type}.asc")
199+
classifiers+=("${classifier}")
200+
done
201+
fi
202+
args+=(-Dfiles="$(
203+
IFS=,
204+
echo "${files[*]}"
205+
)")
206+
args+=(-Dtypes="$(
207+
IFS=,
208+
echo "${types[*]}"
209+
)")
210+
args+=(-Dclassifiers="$(
211+
IFS=,
212+
echo "${classifiers[*]}"
213+
)")
214+
mvn "${args[@]}"
215+
done
216+
217+
echo
218+
echo "Success!"
219+
echo "Press the 'Close' button manually by Web interface:"
220+
echo " https://repository.apache.org/#stagingRepositories"
221+
echo "It publishes the artifacts to the staging repository:"
222+
echo " https://repository.apache.org/content/repositories/staging/org/apache/arrow/"
136223
fi
137224

225+
echo
138226
echo "Draft email for dev@arrow.apache.org mailing list"
139227
echo ""
140228
echo "---------------------------------------------------------"

0 commit comments

Comments
 (0)