Skip to content

Commit 4bf5c08

Browse files
committed
Migrate from OSRH to Central Publisher API
1 parent fae0fba commit 4bf5c08

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed
Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#!/bin/bash -x
22
#
3-
# first you must sign all files:
4-
# find release -type f -print -exec gpg -ab {} \;
3+
# usage:
4+
# VERSION=XXX ./secp256k1-kmp-staging-upload.sh create # to create bundles, which include checksums and signatures (requires access to a valid gpg key)
5+
# VERSION=XXX ./secp256k1-kmp-staging-upload.sh upload # to upload bundles to sonatype's staging area (requires a valid portal token)
56

67
if [[ -z "${VERSION}" ]]; then
78
echo "VERSION is not defined"
89
exit 1
910
fi
1011

11-
if [[ -z "${OSS_USER}" ]]; then
12-
echo "OSS_USER is not defined"
12+
if [[ -z "${CENTRAL_TOKEN_GPG_FILE}" ]]; then
13+
echo "CENTRAL_TOKEN_GPG_FILE is not defined"
1314
exit 1
1415
fi
1516

16-
read -p "Password : " -s OSS_PASSWORD
17-
17+
CENTRAL_TOKEN=$(gpg --decrypt $CENTRAL_TOKEN_GPG_FILE)
1818

19+
pushd .
20+
cd release
1921
for i in secp256k1-kmp \
2022
secp256k1-kmp-iosarm64 \
2123
secp256k1-kmp-iossimulatorarm64 \
@@ -33,12 +35,21 @@ for i in secp256k1-kmp \
3335
secp256k1-kmp-macosarm64 \
3436
secp256k1-kmp-macosx64
3537
do
36-
pushd .
37-
cd release/fr/acinq/secp256k1/$i/$VERSION
38-
pwd
39-
jar -cvf bundle.jar *
40-
# use correct sonatype credentials here
41-
curl -v -XPOST -u $OSS_USER:$OSS_PASSWORD --upload-file bundle.jar https://oss.sonatype.org/service/local/staging/bundle_upload
42-
popd
38+
DIR=fr/acinq/secp256k1/$i/$VERSION
39+
echo DIR is $DIR
40+
case $1 in
41+
create)
42+
for file in $DIR/*
43+
do
44+
sha1sum $file | sed 's/ .*//' > $file.sha1
45+
md5sum $file | sed 's/ .*//' > $file.md5
46+
gpg -ab $file
47+
done
48+
zip -r $i.zip $DIR
49+
;;
50+
upload)
51+
curl --request POST --verbose --header "Authorization: Bearer ${CENTRAL_TOKEN}" --form bundle=@$i.zip https://central.sonatype.com/api/v1/publisher/upload
52+
;;
53+
esac
4354
done
44-
55+
popd

0 commit comments

Comments
 (0)