Skip to content

Commit

Permalink
Migrate to standard Gradle Maven publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
drewhamilton committed Dec 31, 2023
1 parent 4505995 commit 8e8051e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 115 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
distribution: zulu
java-version: 21
- name: Assemble for release
run: ./gradlew clean assembleRelease --stacktrace
run: ./gradlew assembleRelease --stacktrace
- name: Publish
env:
ORG_GRADLE_PROJECT_personalSonatypeIssuesUsername: ${{ secrets.ORG_GRADLE_PROJECT_personalSonatypeIssuesUsername }}
ORG_GRADLE_PROJECT_personalSonatypeIssuesPassword: ${{ secrets.ORG_GRADLE_PROJECT_personalSonatypeIssuesPassword }}
ORG_GRADLE_PROJECT_personalGpgKey: ${{ secrets.ORG_GRADLE_PROJECT_personalGpgKey }}
ORG_GRADLE_PROJECT_personalGpgPassword: ${{ secrets.ORG_GRADLE_PROJECT_personalGpgPassword }}
run: ./gradlew publishReleasePublicationToMavenCentralRepository --stacktrace
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_personalSonatypeIssuesUsername }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_personalSonatypeIssuesPassword }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_personalGpgKey }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_personalGpgPassword }}
run: ./gradlew publish --stacktrace --no-configuration-cache
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ext {
}

allprojects { project ->
group = rootProject.property("GROUP")
version = rootProject.property("VERSION_NAME")

repositories {
google()
mavenCentral()
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ kotlin-gradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
kotlinx-binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.13.2"

materialComponents = "com.google.android.material:material:1.11.0"

[plugins]

mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.26.0" }
102 changes: 0 additions & 102 deletions publish.gradle

This file was deleted.

43 changes: 36 additions & 7 deletions xml-theme/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
alias(libs.plugins.mavenPublish)
}

ext {
artifactName = rootProject.POM_ARTIFACT_ID
publishedDescription = 'An Android theme for Skylight apps.'
}
apply from: '../publish.gradle'

android {
namespace "dev.drewhamilton.skylight.android.brand.xml"
compileSdkVersion projectVersions.compileSdk

defaultConfig {
minSdkVersion projectVersions.minSdk
targetSdkVersion projectVersions.targetSdk
versionName version
versionName rootProject.property("VERSION_NAME")

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down Expand Up @@ -54,3 +51,35 @@ dependencies {
androidTestImplementation(libs.androidx.testRules)
androidTestImplementation(libs.androidx.testRunner)
}

mavenPublishing {
pom {
name.set(property("POM_ARTIFACT_ID"))
description.set("An Android theme for Skylight apps.")

url.set("https://github.com/drewhamilton/SkylightAndroidBrand")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}

developers {
developer {
id.set("drewhamilton")
name.set("Drew Hamilton")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:github.com/drewhamilton/SkylightAndroidBrand.git")
developerConnection.set("scm:git:ssh://github.com/drewhamilton/SkylightAndroidBrand.git")
url.set("https://github.com/drewhamilton/SkylightAndroidBrand")
}
}

publishToMavenCentral(SonatypeHost.DEFAULT, true)
signAllPublications()
}

0 comments on commit 8e8051e

Please sign in to comment.