Skip to content

Commit

Permalink
Add publishing to Maven Central on release (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpelgrom authored Oct 10, 2024
1 parent 57c0765 commit 4d4520e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ jobs:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./app/build/outputs/apk/debug/app-debug.apk
asset_name: demo.apk

- name: Publish to Maven Central
if: github.event.release.draft == 'false'
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
IMPROV_LIB_RELEASE: ${{ github.event.release.tag_name }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PGP_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_PGP_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PGP_KEY_PASSWORD }}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {

plugins {
id 'org.jetbrains.kotlin.plugin.compose' version "$kotlin_version" apply false
id 'com.vanniktech.maven.publish' version '0.29.0' apply false
}

task clean(type: Delete) {
Expand Down
39 changes: 39 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id 'com.android.library'
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
}

android {
Expand Down Expand Up @@ -28,4 +32,39 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
}

mavenPublishing {
configure(new AndroidSingleVariantLibrary("release", true, true))

publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()

coordinates("org.openhomefoundation.improv-wifi", "sdk-android", "${System.getenv('IMPROV_LIB_RELEASE')}")

pom {
name = "Android SDK for Improv Wi-Fi"
description = "Easily detect and connect Improv Wi-Fi devices to the network on Android using BLE"
inceptionYear = "2021"
url = "https://github.com/improv-wifi/sdk-android"
licenses {
license {
name = "Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "improv-wifi"
name = "Improv Wi-Fi"
url = "https://github.com/improv-wifi"
}
}
scm {
url = "https://github.com/improv-wifi/sdk-android"
connection = "scm:git:git://github.com/improv-wifi/sdk-android.git"
developerConnection = "scm:git:ssh://[email protected]/improv-wifi/sdk-android.git"
}
}
}

0 comments on commit 4d4520e

Please sign in to comment.