From 4d20dd168b7c96bb3a9ba7ae75b2c7841947456e Mon Sep 17 00:00:00 2001 From: Fabrice Drouin Date: Mon, 25 Sep 2023 10:03:46 +0200 Subject: [PATCH] Document publishing process (#535) --- publishing/PUBLISHING.md | 32 ++++++++++++++++++++++ publishing/lightning-kmp-staging-upload.sh | 31 +++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 publishing/PUBLISHING.md create mode 100755 publishing/lightning-kmp-staging-upload.sh diff --git a/publishing/PUBLISHING.md b/publishing/PUBLISHING.md new file mode 100644 index 000000000..ceec013dd --- /dev/null +++ b/publishing/PUBLISHING.md @@ -0,0 +1,32 @@ +# Publishing lightning-kmp artifacts + +## snapshots + +Snapshots are published to the Sonatype snapshot repository (https://oss.sonatype.org/content/repositories/snapshots/). +To publish snapshots, you must add your sonatype credentials for the `ossrh` server to your local maven settings (typically in $HOME/.m2/settings.xml) + +- Download `snapshot.zip` generated by the `Publish snapshot` github action +- unzip `snapshot.zip` in the `publishing` directory +- run `lightning-kmp-snapshot-deploy.sh` + +For example: + +```shell +$ VERSION=1.2.3-SNAPSHOT ./lightning-kmp-snapshot-deploy.sh +``` + +## releases + +Releases are published to the Sonatype staging repository. If all items are valid they will be published to `maven central` repository. + +- Download `release.zip` generated by the `Publish release` github action (which is triggered every time you publish a github release) +- unzip `release.zip` in the `publishing` directory +- sign all artifacts with a valid gpg key: `find release -type f -print -exec gpg -ab {} \;` +- run `lightning-kmp-staging-upload.sh` +- log into sonatype, close and publish your staging repository. Artifacts will be available on Maven Central within a few hours. + +For example: + +```shell +$ VERSION=1.2.3 OSS_USER=my_sonatype_username ./lightning-kmp-staging-upload.sh +``` \ No newline at end of file diff --git a/publishing/lightning-kmp-staging-upload.sh b/publishing/lightning-kmp-staging-upload.sh new file mode 100755 index 000000000..667a67644 --- /dev/null +++ b/publishing/lightning-kmp-staging-upload.sh @@ -0,0 +1,31 @@ +#!/bin/bash -x +# +# first you must sign all files with something like: +# find release -type f -print -exec gpg -ab {} \; +# + +if [[ -z "${VERSION}" ]]; then + echo "VERSION is not defined" + exit 1 +fi + +if [[ -z "${OSS_USER}" ]]; then + echo "OSS_USER is not defined" + exit 1 +fi + +read -p "Password : " -s OSS_PASSWORD + +for i in lightning-kmp \ + lightning-kmp-iosarm64 \ + lightning-kmp-iosx64 \ + lightning-kmp-jvm \ + lightning-kmp-linux +do + pushd . + cd release/fr/acinq/lightning/$i/$VERSION &&\ + pwd &&\ + jar -cvf bundle.jar *&&\ + curl -v -XPOST -u $OSS_USER:$OSS_PASSWORD --upload-file bundle.jar https://oss.sonatype.org/service/local/staging/bundle_upload + popd +done