Skip to content

Commit a3cea04

Browse files
authored
Merge pull request #78 from AppDevNext/PublishPackages
Publish to Github packages
2 parents f57d489 + 82a0c8f commit a3cea04

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ jobs:
4343
files: MPChartLib/build/outputs/aar/MPChartLib-release.aar
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Publish to github package
48+
run: ./gradlew publish
49+
env:
50+
GITHUBACTOR: ${{ secrets.GITHUBACTOR }}
51+
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}

MPChartLib/build.gradle

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ plugins {
33
id 'maven-publish'
44
}
55

6+
// 2. Declare library details
7+
ext {
8+
mGroupId = "info.appdevnext"
9+
mArtifactId = "chart"
10+
mVersionName = getTag()
11+
12+
mLibraryName = "Android Chart"
13+
mLibraryDescription = "A powerful Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations"
14+
}
15+
616
android {
717
compileSdkVersion 33
818
defaultConfig {
@@ -32,11 +42,46 @@ dependencies {
3242
testImplementation 'junit:junit:4.13.2'
3343
}
3444

45+
task androidSourcesJar(type: Jar) {
46+
archiveClassifier.set('sources')
47+
from android.sourceSets.main.java.srcDirs
48+
}
49+
3550
project.afterEvaluate {
3651
publishing {
52+
// publications {
53+
// release(MavenPublication) {
54+
// from components.release
55+
// }
56+
// }
57+
3758
publications {
38-
release(MavenPublication) {
59+
maven(MavenPublication) {
60+
groupId mGroupId
61+
artifactId mArtifactId
62+
version mVersionName
63+
3964
from components.release
65+
66+
// artifact androidSourcesJar
67+
// artifact("$buildDir/outputs/aar/MPChartLib-release.aar")
68+
69+
pom {
70+
name = mLibraryName
71+
description = mLibraryDescription
72+
}
73+
}
74+
}
75+
76+
repositories {
77+
maven {
78+
version = getTag()
79+
name = "GitHubPackages"
80+
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
81+
credentials {
82+
username = System.getenv("GITHUBACTOR")
83+
password = System.getenv("GITHUBTOKEN")
84+
}
4085
}
4186
}
4287
}

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
:zap: A powerful & easy to use chart library for Android :zap:
55

6-
### Gradle Setup
6+
### Gradle Setup with jitpack.io
77

88
```gradle
99
repositories {
@@ -14,6 +14,27 @@ dependencies {
1414
implementation "com.github.AppDevNext:MPAndroidChart:$latestVersion"
1515
}
1616
```
17+
### Gradle Setup with Github package
18+
19+
```gradle
20+
repositories {
21+
...
22+
repositories {
23+
maven {
24+
name = "GitHubPackages"
25+
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
26+
credentials {
27+
username = System.getenv("GITHUBACTOR")
28+
password = System.getenv("GITHUBTOKEN")
29+
}
30+
}
31+
}
32+
}
33+
34+
dependencies {
35+
implementation "info.appdevnext:chart:$latestVersion"
36+
}
37+
```
1738

1839
<br/>
1940

0 commit comments

Comments
 (0)