-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: publish artifact to maven configuration (#28)
- Loading branch information
1 parent
99fdf0a
commit af4d9e2
Showing
6 changed files
with
141 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Publish SDK | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
deploy-release: | ||
runs-on: ubuntu-22.04 | ||
if: startsWith(github.ref, 'refs/tags') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout code | ||
- uses: burrunan/gradle-cache-action@v1 | ||
name: Deploy Release | ||
env: | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
with: | ||
job-id: release | ||
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
plugins { | ||
`maven-publish` | ||
signing | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.jetbrains.kotlin.android) | ||
id("org.jetbrains.dokka") version "1.7.10" | ||
id("pl.allegro.tech.build.axion-release") version "1.13.6" | ||
} | ||
|
||
val tagVersion = System.getenv("GITHUB_REF")?.split('/')?.last() | ||
project.version = scmVersion.version | ||
|
||
android { | ||
namespace = "io.getunleash.android" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 21 | ||
|
||
aarMetadata { | ||
minCompileSdk = 29 | ||
} | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
consumerProguardFiles("proguard-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
debug { | ||
|
||
} | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
|
@@ -30,18 +43,26 @@ android { | |
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
publishing { | ||
multipleVariants { | ||
includeBuildTypeValues("debug", "release") | ||
allVariants() | ||
withJavadocJar() | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(libs.androidx.core.ktx) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.work.ktx) | ||
implementation(libs.androidx.lifecycle.process) | ||
implementation(libs.jackson.databind) | ||
implementation(libs.jackson.core) | ||
implementation(libs.jackson.module.kotlin) | ||
implementation(libs.jackson.datatype.jsr310) | ||
implementation(libs.androidx.lifecycle.process) | ||
api(libs.okhttp) | ||
|
||
testImplementation(libs.junit) | ||
|
@@ -58,4 +79,69 @@ dependencies { | |
androidTestImplementation(libs.androidx.junit) | ||
androidTestImplementation(libs.androidx.espresso.core) | ||
androidTestImplementation(libs.okhttp.mockserver) | ||
} | ||
} | ||
|
||
publishing { | ||
repositories { | ||
repositories { | ||
maven { | ||
url = uri(layout.buildDirectory.dir("repo")) | ||
name = "test" | ||
} | ||
} | ||
mavenLocal() | ||
} | ||
|
||
publications { | ||
afterEvaluate { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["release"]) | ||
groupId = "io.getunleash" | ||
artifactId = "unleash-android" | ||
version = version | ||
pom { | ||
name.set("Unleash Android") | ||
description.set("Android SDK for Unleash") | ||
url.set("https://gh.getunleash.io/unleash-android") | ||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("gastonfournier") | ||
name.set("Gastón Fournier") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("chrkolst") | ||
name.set("Christopher Kolstad") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("ivarconr") | ||
name.set("Ivar Conradi Østhus") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:https://github.com/Unleash/unleash-android") | ||
developerConnection.set("scm:git:ssh://[email protected]:Unleash/unleash-android") | ||
url.set("https://github.com/Unleash/unleash-android") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
val signingKey: String? by project | ||
val signingPassphrase: String? by project | ||
signing { | ||
if (signingKey != null && signingPassphrase != null) { | ||
useInMemoryPgpKeys(signingKey, signingPassphrase) | ||
sign(publishing.publications["mavenJava"]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters