Skip to content

Commit dec5dcf

Browse files
authored
Merge pull request #1 from LinX64/feature/publishing-to-central-maven
Init 2
2 parents e273767 + 2803632 commit dec5dcf

File tree

7 files changed

+39
-32
lines changed

7 files changed

+39
-32
lines changed

.github/workflows/publish.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,12 @@ jobs:
8383
env:
8484
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8585
tag: ${{ github.ref_name }}
86-
RELEASE_VERSION: ${{ github.event.inputs.release-version }}
86+
RELEASE_VERSION: ${{ github.event.inputs.release-version }}
87+
88+
- name: Publish Library on Maven Central
89+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
90+
env:
91+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
92+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSWORD }}
93+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
94+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ plugins {
33
alias(libs.plugins.jetbrains.kotlin.android) apply false
44
alias(libs.plugins.android.library) apply false
55
alias(libs.plugins.detekt) apply false
6+
alias(libs.plugins.mavenPublish) apply false
67
}

gradle.properties

+21-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1-
# Project-wide Gradle settings.
2-
# IDE (e.g. Android Studio) users:
3-
# Gradle settings configured through the IDE *will override*
4-
# any settings specified in this file.
5-
# For more details on how to configure your publish.yaml environment visit
6-
# http://www.gradle.org/docs/current/userguide/build_environment.html
7-
# Specifies the JVM arguments used for the daemon process.
8-
# The setting is particularly useful for tweaking memory settings.
9-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10-
# When configured, Gradle will run in incubating parallel mode.
11-
# This option should only be used with decoupled projects. For more details, visit
12-
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13-
# org.gradle.parallel=true
14-
# AndroidX package structure to make it clearer which packages are bundled with the
15-
# Android operating system, and which are packaged with your app's APK
16-
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17-
android.useAndroidX=true
18-
# Kotlin code style for this project: "official" or "obsolete":
191
kotlin.code.style=official
20-
# Enables namespacing of each library's R class so that its R class includes only the
21-
# resources declared in the library itself and none from the library's dependencies,
22-
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
242

25-
android.defaults.buildfeatures.resvalues=false
26-
android.defaults.buildfeatures.shaders=false
27-
org.gradle.caching=true
28-
org.gradle.configuration-cache.problems=warn
29-
org.gradle.configureondemand=false
30-
org.gradle.parallel=true
3+
GROUP=io.github.linx64
4+
VERSION_NAME=1.0
5+
6+
# Library configuration
7+
SONATYPE_HOST=DEFAULT
8+
RELEASE_SIGNING_ENABLED=true
9+
10+
POM_INCEPTION_YEAR=2024
11+
POM_URL=https://github.com/LinX64/Reusable
12+
13+
POM_LICENSE_NAME=Apache License, Version 2.0
14+
POM_LICENSE_URL=https://raw.githubusercontent.com/LinX64/Reusable/master/LICENSE
15+
POM_LICENSE_DIST=repo
16+
17+
POM_SCM_URL=https://github.com/LinX64/Reusable/
18+
POM_SCM_CONNECTION=scm:git:git://github.com/LinX64/Reusable.git
19+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/LinX64/Reusable.git
20+
21+
POM_DEVELOPER_ID=LinX64
22+
POM_DEVELOPER_NAME=Mohsen
23+
POM_DEVELOPER_URL=https://github.com/LinX64/

gradle/libs.versions.toml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ activityCompose = "1.8.2"
88
composeBom = "2024.04.00"
99
material-3 = "1.2.1"
1010
detekt = "1.23.6"
11+
mavenPublish = "0.28.0"
1112

1213
[libraries]
1314
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -30,3 +31,4 @@ android-application = { id = "com.android.application", version.ref = "agp" }
3031
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
3132
android-library = { id = "com.android.library", version.ref = "agp" }
3233
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
34+
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
7-
zipStorePath=wrapper/dists
7+
zipStorePath=wrapper/dists

reusablecomponents/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
alias(libs.plugins.android.library)
33
alias(libs.plugins.jetbrains.kotlin.android)
44
alias(libs.plugins.detekt)
5-
id("maven-publish")
5+
id(libs.plugins.mavenPublish.get().pluginId)
66
}
77

88
android {
@@ -81,7 +81,7 @@ publishing {
8181
register<MavenPublication>("release") {
8282
groupId = "io.github.linx64"
8383
artifactId = "reusablecomponents"
84-
version = System.getenv("RELEASE_VERSION")
84+
version = "1.0.0"
8585
artifact("build/outputs/aar/${artifactId}-release.aar")
8686
}
8787

reusablecomponents/gradle.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POM_ARTIFACT_ID=reusablecomponents
2+
POM_NAME=Reusable Components for Jetpack Compose
3+
POM_DESCRIPTION=This library contains reusable components for Jetpack Compose.

0 commit comments

Comments
 (0)