Skip to content

Commit 8e77407

Browse files
committed
Publish to mavenCentral() with Vannik plugin
1 parent 5a4c8c7 commit 8e77407

File tree

2 files changed

+47
-27
lines changed

2 files changed

+47
-27
lines changed

.github/workflows/Android-CI-release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install Android SDK
3030
uses: malinskiy/action-android/install-sdk@release/0.1.4
3131
- name: Build project
32-
run: ./gradlew clean build
32+
run: ./gradlew assembleRelease
3333
env:
3434
VERSION: ${{ github.ref }}
3535

@@ -49,3 +49,11 @@ jobs:
4949
env:
5050
GITHUBACTOR: ${{ secrets.GITHUBACTOR }}
5151
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
52+
53+
- name: Publish mavenCentral (stage)
54+
run: |
55+
signing/decrypt.sh
56+
cat signing/gradle_secure.properties >> gradle.properties
57+
./gradlew publish MPChartLib:publishMavenPublicationToMavenCentralRepository
58+
env:
59+
CRYPT_PASS: ${{ secrets.CRYPT_PASS }}

MPChartLib/build.gradle

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'com.android.library'
33
id 'maven-publish'
4+
id "com.vanniktech.maven.publish" version "0.22.0"
45
}
56

67
ext {
@@ -46,36 +47,47 @@ task androidSourcesJar(type: Jar) {
4647
from android.sourceSets.main.java.srcDirs
4748
}
4849

49-
project.afterEvaluate {
50-
publishing {
51-
publications {
52-
maven(MavenPublication) {
53-
groupId mGroupId
54-
artifactId mArtifactId
55-
version mVersionName
50+
group = "info.mxtracks"
51+
version = "${getTag()}"
52+
println "Build version $version"
5653

57-
from components.release
58-
59-
// artifact androidSourcesJar
60-
// artifact("$buildDir/outputs/aar/MPChartLib-release.aar")
61-
62-
pom {
63-
name = mLibraryName
64-
description = mLibraryDescription
65-
}
54+
mavenPublishing {
55+
pom {
56+
name = "Android Chart"
57+
description = "A powerful Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations"
58+
inceptionYear = "2022"
59+
url = "https://github.com/AppDevNext/AndroidChart/"
60+
licenses {
61+
license {
62+
name = "The Apache License, Version 2.0"
63+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
64+
distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
65+
}
66+
}
67+
developers {
68+
developer {
69+
id = "AppDevNext"
70+
name = "AppDevNext"
71+
url = "https://github.com/AppDevNext/"
6672
}
6773
}
74+
scm {
75+
url = "https://github.com/AppDevNext/AndroidChart/"
76+
connection = "scm:git:git://github.com/AppDevNext/AndroidChart.git"
77+
developerConnection = "scm:git:ssh://git@github.com/AppDevNext/AndroidChart.git"
78+
}
79+
}
6880

69-
repositories {
70-
maven {
71-
version = getTag()
72-
name = "GitHubPackages"
73-
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
74-
credentials {
75-
username = System.getenv("GITHUBACTOR")
76-
password = System.getenv("GITHUBTOKEN")
77-
}
81+
// Github packages
82+
repositories {
83+
maven {
84+
version = version+"-SNAPSHOT"
85+
name = "GitHubPackages"
86+
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
87+
credentials {
88+
username = System.getenv("GITHUBACTOR")
89+
password = System.getenv("GITHUBTOKEN")
7890
}
7991
}
8092
}
81-
}
93+
}

0 commit comments

Comments
 (0)