Skip to content

Commit c86d5b9

Browse files
SessionHero01SessionHero01
authored andcommitted
Add publishing
1 parent 7d48b11 commit c86d5b9

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

library/build.gradle.kts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
alias(libs.plugins.android.library)
33
alias(libs.plugins.kotlin.android)
4+
id("maven-publish")
45
}
56

67
android {
@@ -38,6 +39,65 @@ android {
3839
kotlinOptions {
3940
jvmTarget = "11"
4041
}
42+
43+
publishing {
44+
singleVariant("release") {
45+
withSourcesJar()
46+
}
47+
}
48+
}
49+
50+
publishing {
51+
publications {
52+
create<MavenPublication>("release") {
53+
groupId = "org.sessionfoundation"
54+
artifactId = "libsession-util-android"
55+
version = System.getenv("VERSION") ?: "dev-snapshot"
56+
57+
pom {
58+
url = "getsession.org"
59+
60+
licenses {
61+
license {
62+
name = "GNU GENERAL PUBLIC LICENSE, Version 3"
63+
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
64+
}
65+
}
66+
67+
scm {
68+
connection = "scm:git:https://github.com/session-foundation/libsession-android"
69+
url = "https://github.com/session-foundation/libsession-android"
70+
}
71+
}
72+
73+
afterEvaluate {
74+
from(components["release"])
75+
}
76+
}
77+
78+
repositories {
79+
maven {
80+
name = "libsession-util-android"
81+
url = uri(layout.buildDirectory.dir("repo"))
82+
}
83+
84+
val githubUser = System.getenv("GITHUB_USER").orEmpty()
85+
val githubToken = System.getenv("GITHUB_TOKEN").orEmpty()
86+
87+
// Only enable the github remote repository if credentials are given
88+
if (githubUser.isNotBlank() && githubToken.isNotBlank()) {
89+
maven {
90+
name = "libsession-util-android"
91+
url =
92+
uri("https://maven.pkg.github.com/session-foundation/libsession-android")
93+
credentials {
94+
username = githubUser
95+
password = githubToken
96+
}
97+
}
98+
}
99+
}
100+
}
41101
}
42102

43103
dependencies {

0 commit comments

Comments
 (0)