From dced64c4fb065601e012befb9a7528886f8bda95 Mon Sep 17 00:00:00 2001 From: Evan Boucher <24446562+ejboucher@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:51:31 -0500 Subject: [PATCH 1/3] Add build and publish actions --- .github/workflows/build.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ README.md | 4 ++-- build.gradle.kts | 9 --------- gradle.properties | 23 +++++++++++++++++++++++ library/build.gradle.kts | 4 ++-- 6 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/publish.yml create mode 100644 gradle.properties diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..302e49a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: build + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + # cancel jobs on PRs only + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checking out branch + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Build with Gradle + run: ./gradlew build \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c4c1ca8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: publish + +on: + release: + types: [created] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checking out branch + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Build with Gradle + run: ./gradlew build + + - name: Publish to Maven Central + env: + ORG_GRADLE_PROJECT_AuthSDKUsername: ${{ secrets.SONATYPE_ACCOUNT_USERNAME }} + ORG_GRADLE_PROJECT_AuthSDKPassword: ${{ secrets.SONATYPE_ACCOUNT_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SONATYPE_ACCOUNT_GPG_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SONATYPE_ACCOUNT_GPG_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SONATYPE_ACCOUNT_GPG_KEY_PASSWORD }} + run: ./gradlew publishAllPublicationsToAuthSDKRepository diff --git a/README.md b/README.md index 0da70eb..0317b1a 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Check the latest version of [auth SDK](https://mvnrepository.com/artifact/softwa Add the following lines to the dependencies section of your build.gradle file in Android Studio: ``` gradle -implementation("software.amazon.location:tracking:0.0.2") -implementation("software.amazon.location:auth:0.0.2") +implementation("software.amazon.location:tracking:0.2.4") +implementation("software.amazon.location:auth:0.2.4") implementation("aws.sdk.kotlin:location:1.2.21") ``` diff --git a/build.gradle.kts b/build.gradle.kts index 207f87c..26b2a2c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,4 @@ plugins { id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("com.android.library") version "8.2.2" apply false - id("com.gradleup.nmcp") version "0.0.4" } - -nmcp { - publishAllProjectsProbablyBreakingProjectIsolation { - username = findProperty("mavenCentralUsername").toString() - password = findProperty("mavenCentralPassword").toString() - publicationType = "AUTOMATIC" - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..3c5031e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,23 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 5b6417c..7edf50f 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -11,7 +11,7 @@ mavenPublishing { publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true) signAllPublications() - coordinates("software.amazon.location", "tracking", "0.0.2") + coordinates("software.amazon.location", "tracking", "0.2.4") pom { name.set("My Library") @@ -87,7 +87,7 @@ dependencies { if (findProject(":authSdk") != null) { implementation(project(":authSdk")) } else { - implementation("software.amazon.location:auth:0.0.2") + implementation("software.amazon.location:auth:0.2.4") } val roomVersion = "2.6.1" From 094624534782115f93d3623fdf41b28e6b99422b Mon Sep 17 00:00:00 2001 From: Evan Boucher <24446562+ejboucher@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:59:08 -0500 Subject: [PATCH 2/3] Include location information in manifest file --- library/src/main/AndroidManifest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 44008a4..f93273a 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1,4 +1,6 @@ - - + + + \ No newline at end of file From 1fac927675b743553fb1359dd2dbf2e13e2c99cf Mon Sep 17 00:00:00 2001 From: Evan Boucher <24446562+ejboucher@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:16:27 -0500 Subject: [PATCH 3/3] Add full publishing information --- .github/workflows/publish.yml | 6 +++--- library/build.gradle.kts | 30 ++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c4c1ca8..e6ba136 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,9 +26,9 @@ jobs: - name: Publish to Maven Central env: - ORG_GRADLE_PROJECT_AuthSDKUsername: ${{ secrets.SONATYPE_ACCOUNT_USERNAME }} - ORG_GRADLE_PROJECT_AuthSDKPassword: ${{ secrets.SONATYPE_ACCOUNT_PASSWORD }} + ORG_GRADLE_PROJECT_TrackingSDKUsername: ${{ secrets.SONATYPE_ACCOUNT_USERNAME }} + ORG_GRADLE_PROJECT_TrackingSDKPassword: ${{ secrets.SONATYPE_ACCOUNT_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SONATYPE_ACCOUNT_GPG_KEY }} ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SONATYPE_ACCOUNT_GPG_KEY_ID }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SONATYPE_ACCOUNT_GPG_KEY_PASSWORD }} - run: ./gradlew publishAllPublicationsToAuthSDKRepository + run: ./gradlew publishAllPublicationsToTrackingSDKRepository diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 7edf50f..4d2455a 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -7,6 +7,16 @@ plugins { id("com.vanniktech.maven.publish") version "0.27.0" } +publishing { + repositories { + maven { + name = "TrackingSDK" + url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials(PasswordCredentials::class) + } + } +} + mavenPublishing { publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true) signAllPublications() @@ -14,10 +24,10 @@ mavenPublishing { coordinates("software.amazon.location", "tracking", "0.2.4") pom { - name.set("My Library") - description.set("A description of what my library does.") - inceptionYear.set("2020") - url.set("https://github.com/username/mylibrary/") + name.set("Amazon Location Service Mobile Tracking SDK for Android") + description.set("These utilities help you when making Amazon Location Service API calls from your Android applications. This library uses the AWS SDK to call tracking APIs.") + inceptionYear.set("2024") + url.set("https://github.com/aws-geospatial/amazon-location-mobile-tracking-sdk-android") licenses { license { name.set("The Apache License, Version 2.0") @@ -27,15 +37,15 @@ mavenPublishing { } developers { developer { - id.set("username") - name.set("User Name") - url.set("https://github.com/username/") + id.set("aws-geospatial") + name.set("AWS Geospatial") + url.set("https://github.com/aws-geospatial") } } scm { - url.set("https://github.com/username/mylibrary/") - connection.set("scm:git:git://github.com/username/mylibrary.git") - developerConnection.set("scm:git:ssh://git@github.com/username/mylibrary.git") + url.set("https://github.com/aws-geospatial/amazon-location-mobile-tracking-sdk-android") + connection.set("scm:git:git://github.com/aws-geospatial/amazon-location-mobile-tracking-sdk-android") + developerConnection.set("scm:git:ssh://git@github.com/aws-geospatial/amazon-location-mobile-tracking-sdk-android") } } }