Skip to content

Commit

Permalink
Merge pull request #3 from ejboucher/main
Browse files Browse the repository at this point in the history
Add GitHub build and publish actions
  • Loading branch information
ejboucher authored Jun 21, 2024
2 parents 3df83ad + 1fac927 commit e43401f
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 25 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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_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 publishAllPublicationsToTrackingSDKRepository
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
```

Expand Down
9 changes: 0 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
}
}
23 changes: 23 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
34 changes: 22 additions & 12 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@ 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()

coordinates("software.amazon.location", "tracking", "0.0.2")
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")
Expand All @@ -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://[email protected]/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://[email protected]/aws-geospatial/amazon-location-mobile-tracking-sdk-android")
}
}
}
Expand Down Expand Up @@ -87,7 +97,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"
Expand Down
6 changes: 4 additions & 2 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
</manifest>

0 comments on commit e43401f

Please sign in to comment.