From be6be7100eb455c30a62a231c1ceabbb1b1b0a9d Mon Sep 17 00:00:00 2001 From: Jun Luo <4catcode@gmail.com> Date: Sun, 31 Mar 2024 18:53:52 +0800 Subject: [PATCH] release: 0.43.1 (#4) --- .github/workflows/test-deploy.yml | 48 ++++++++++++++------ CHANGELOG.md | 5 +++ README.md | 38 +++++++++------- android_test/app/build.gradle.kts | 5 +-- android_test/settings.gradle.kts | 1 - build.gradle.kts | 75 ++++++++++++++++++++++--------- jitpack.yml | 4 +- settings.gradle.kts | 2 +- 8 files changed, 120 insertions(+), 58 deletions(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 89f2f8e..1913a08 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -10,7 +10,7 @@ on: - created env: - JAVA_VERSION: '17' + JAVA_VERSION: '21' JAVA_DISTRIBUTION: 'microsoft' jobs: @@ -18,9 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} @@ -32,16 +32,16 @@ jobs: needs: test steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} - name: Build run: ./gradlew build - name: Persist JAR Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: libs path: build/libs/*.jar @@ -61,13 +61,13 @@ jobs: ] steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download JAR Artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: libs path: android_test/app/libs/ - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} @@ -84,7 +84,7 @@ jobs: arch: x86_64 profile: 'pixel_2' - deploy: + deploy-gh-releases: needs: [ android-test ] permissions: contents: write @@ -92,14 +92,36 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download JAR Artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: libs path: libs - name: Upload artifacts to GitHub Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | libs/*.jar + + + deploy-maven-central: + needs: [ android-test ] + if: github.event_name == 'release' && github.event.action == 'created' + runs-on: ubuntu-latest + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRIBUTION }} + - name: Publish to Maven Central + run: ./gradlew publishAllPublicationsToCentralPortal \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 46073fc..fef0287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.43.1 +* Bump `java-stellar-sdk` from 0.43.0 to 0.43.1. ([#4](https://github.com/lightsail-network/java-stellar-sdk-android-spi/pull/4)) +* Publish the publication to Maven Central. ([#4](https://github.com/lightsail-network/java-stellar-sdk-android-spi/pull/4)) +* Build the project with JDK 21. ([#4](https://github.com/lightsail-network/java-stellar-sdk-android-spi/pull/4)) + ## 0.43.0 * Bump `java-stellar-sdk` from 0.42.0 to 0.43.0 diff --git a/README.md b/README.md index ebfa1e8..dc89a48 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,37 @@ # java-stellar-sdk-android-spi -[![Test and Deploy](https://github.com/stellar/java-stellar-sdk-android-spi/actions/workflows/test-deploy.yml/badge.svg?branch=main)](https://github.com/stellar/java-stellar-sdk-android-spi/actions/workflows/test-deploy.yml) -[![](https://jitpack.io/v/stellar/java-stellar-sdk-android-spi.svg)](https://jitpack.io/#stellar/java-stellar-sdk-android-spi) +[![Test and Deploy](https://github.com/lightsail-network/java-stellar-sdk-android-spi/actions/workflows/test-deploy.yml/badge.svg?branch=main)](https://github.com/lightsail-network/java-stellar-sdk-android-spi/actions/workflows/test-deploy.yml) +[![Maven Central Version](https://img.shields.io/maven-central/v/network.lightsail/stellar-sdk-android-spi)](https://central.sonatype.com/artifact/network.lightsail/stellar-sdk-android-spi) -The goal of this library is to enable users to conveniently integrate the Java Stellar SDK into lower versions of the Android platform. In this context, lower versions refer to Android API level 23 to 27. If your minSdk is set to 28 or higher, you do not need to include this library. +The goal of this library is to enable users to conveniently integrate the Java Stellar SDK into lower versions of the +Android platform. In this context, lower versions refer to Android API level 23 to 27. If your minSdk is set to 28 or +higher, you do not need to include this library. ## Installation -### Maven - -Use [jitpack.io](https://jitpack.io)'s Maven repository: +### Apache Maven +```xml + + network.lightsail + stellar-sdk-android-spi + 0.43.1 + ``` -repositories { - maven { url "https://jitpack.io" } -} - -dependencies { - implementation 'com.github.stellar:java-stellar-sdk:{version}' - implementation 'com.github.stellar:java-stellar-sdk-android-spi:{version}' -} + +### Gradle + +```groovy +implementation 'network.lightsail:stellar-sdk-android-spi:0.43.1' ``` The versions of `java-stellar-sdk` and `java-stellar-sdk-android-spi` should be maintained at the same version. -The list of versions to install can be found in the [Releases](https://github.com/stellar/java-stellar-sdk-android-spi/releases) section. More information can be found in [jitpack.io docs](https://jitpack.io/docs/). +You can find instructions on how to install this dependency using alternative package +managers [here](https://central.sonatype.com/artifact/network.lightsail/stellar-sdk-android-spi). ### JAR -Download the latest jar from the GitHub repo's [releases tab](https://github.com/stellar/java-stellar-sdk-android-spi/releases). Add the `jar` package to your project according to how your environment is set up. +Download the latest jar from the GitHub +repo's [releases tab](https://github.com/lightsail-network/java-stellar-sdk-android-spi/releases). Add the `jar` package +to your project according to how your environment is set up. diff --git a/android_test/app/build.gradle.kts b/android_test/app/build.gradle.kts index 6ed344d..882e2c3 100644 --- a/android_test/app/build.gradle.kts +++ b/android_test/app/build.gradle.kts @@ -66,9 +66,8 @@ dependencies { implementation("androidx.compose.ui:ui-graphics") implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.material3:material3") - implementation(files("libs/stellar-sdk-android-spi.jar")) - implementation("com.github.stellar:java-stellar-sdk:0.43.0") - + implementation(files("libs/stellar-sdk-android-spi-0.43.1.jar")) + implementation("network.lightsail:stellar-sdk:0.43.1") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0-alpha03") androidTestImplementation("androidx.test.ext:junit:1.1.5") diff --git a/android_test/settings.gradle.kts b/android_test/settings.gradle.kts index 83bd517..756213d 100644 --- a/android_test/settings.gradle.kts +++ b/android_test/settings.gradle.kts @@ -10,7 +10,6 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven { url = uri("https://jitpack.io") } } } diff --git a/build.gradle.kts b/build.gradle.kts index 91daa6b..24c652f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,18 +1,21 @@ plugins { id("java") - id("java-library") + id("signing") id("maven-publish") id("project-report") id("com.diffplug.spotless") version "6.21.0" id("com.github.ben-manes.versions") version "0.48.0" + id("com.gradleup.nmcp") version "0.0.4" } -group = "stellar" -version = "0.43.0" +group = "network.lightsail" +version = "0.43.1" java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 + withJavadocJar() + withSourcesJar() } spotless { @@ -25,22 +28,13 @@ spotless { repositories { mavenCentral() - maven { url = uri("https://jitpack.io") } } dependencies { - implementation("com.github.stellar:java-stellar-sdk:0.43.0") + implementation("network.lightsail:stellar-sdk:0.43.1") } tasks { - jar { - manifest { - attributes["Implementation-Title"] = "stellar-sdk-android-spi" - attributes["Implementation-Version"] = version - } - archiveFileName = "stellar-sdk-android-spi.jar" - } - register("updateGitHook") { from("scripts/pre-commit.sh") { rename { it.removeSuffix(".sh") } } into(".git/hooks") @@ -58,31 +52,68 @@ tasks { } } -artifacts { - archives(tasks.jar) -} - publishing { publications { create("mavenJava") { + artifactId = "stellar-sdk-android-spi" from(components["java"]) pom { - name.set("java-stellar-sdk-android-spi") + name.set("stellar-sdk-android-spi") description.set("Java Stellar SDK Android SPI implementation") - url.set("https://github.com/stellar/java-stellar-sdk-android-spi") + url.set("https://github.com/lightsail-network/java-stellar-sdk-android-spi") licenses { license { name.set("The Apache License, Version 2.0") - url.set("https://github.com/stellar/java-stellar-sdk-android-spi/blob/master/LICENSE") + url.set("https://github.com/lightsail-network/java-stellar-sdk-android-spi/blob/main/LICENSE") + distribution.set("https://github.com/lightsail-network/java-stellar-sdk-android-spi/blob/main/LICENSE") } } developers { developer { - id.set("stellar") - name.set("Stellar Development Foundation") + id.set("overcat") + name.set("Jun Luo") + url.set("https://github.com/overcat") + } + organization { + name.set("Lightsail Network") + url.set("https://github.com/lightsail-network") } } + scm { + url.set("https://github.com/lightsail-network/java-stellar-sdk-android-spi") + connection.set("scm:git:https://github.com/lightsail-network/java-stellar-sdk-android-spi.git") + developerConnection.set("scm:git:ssh://git@github.com/lightsail-network/java-stellar-sdk-android-spi.git") + } } } } } + +signing { + val publishCommand = "publishAllPublicationsToCentralPortal" + isRequired = gradle.startParameter.taskNames.contains(publishCommand) + println("Need to sign? $isRequired") + // https://docs.gradle.org/current/userguide/signing_plugin.html#using_in_memory_ascii_armored_openpgp_subkeys + // export SIGNING_KEY=$(gpg2 --export-secret-keys --armor {SIGNING_KEY_ID} | grep -v '\-\-' | grep -v '^=.' | tr -d '\n') + val signingKey = System.getenv("SIGNING_KEY") + val signingKeyId = System.getenv("SIGNING_KEY_ID") + val signingPassword = System.getenv("SIGNING_PASSWORD") + if (isRequired && (signingKey == null || signingKeyId == null || signingPassword == null)) { + throw IllegalStateException("Please set the SIGNING_KEY, SIGNING_KEY_ID, and SIGNING_PASSWORD environment variables.") + } + println("Signing Key ID: $signingKeyId") + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications["mavenJava"]) +} + +nmcp { + // https://github.com/GradleUp/nmcp + publishAllProjectsProbablyBreakingProjectIsolation { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") + // publish manually from the portal + publicationType = "USER_MANAGED" + // or if you want to publish automatically + // publicationType = "AUTOMATIC" + } +} diff --git a/jitpack.yml b/jitpack.yml index 5fc872f..0409b2b 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,4 +1,4 @@ before_install: - - sdk install java 17.0.8.1-ms - - sdk use java 17.0.8.1-ms + - sdk install java 21.0.2-ms + - sdk use java 21.0.2-ms diff --git a/settings.gradle.kts b/settings.gradle.kts index 8a06a37..78c0cd6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,2 @@ -rootProject.name = "java-stellar-sdk-android-spi" +rootProject.name = "stellar-sdk-android-spi"