Skip to content

Commit

Permalink
Merge pull request #78 from AppDevNext/PublishPackages
Browse files Browse the repository at this point in the history
Publish to Github packages
  • Loading branch information
hannesa2 authored Dec 23, 2022
2 parents f57d489 + 82a0c8f commit a3cea04
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/Android-CI-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ jobs:
files: MPChartLib/build/outputs/aar/MPChartLib-release.aar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to github package
run: ./gradlew publish
env:
GITHUBACTOR: ${{ secrets.GITHUBACTOR }}
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
47 changes: 46 additions & 1 deletion MPChartLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ plugins {
id 'maven-publish'
}

// 2. Declare library details
ext {
mGroupId = "info.appdevnext"
mArtifactId = "chart"
mVersionName = getTag()

mLibraryName = "Android Chart"
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"
}

android {
compileSdkVersion 33
defaultConfig {
Expand Down Expand Up @@ -32,11 +42,46 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
}

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

project.afterEvaluate {
publishing {
// publications {
// release(MavenPublication) {
// from components.release
// }
// }

publications {
release(MavenPublication) {
maven(MavenPublication) {
groupId mGroupId
artifactId mArtifactId
version mVersionName

from components.release

// artifact androidSourcesJar
// artifact("$buildDir/outputs/aar/MPChartLib-release.aar")

pom {
name = mLibraryName
description = mLibraryDescription
}
}
}

repositories {
maven {
version = getTag()
name = "GitHubPackages"
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
credentials {
username = System.getenv("GITHUBACTOR")
password = System.getenv("GITHUBTOKEN")
}
}
}
}
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

### Gradle Setup
### Gradle Setup with jitpack.io

```gradle
repositories {
Expand All @@ -14,6 +14,27 @@ dependencies {
implementation "com.github.AppDevNext:MPAndroidChart:$latestVersion"
}
```
### Gradle Setup with Github package

```gradle
repositories {
...
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/AppDevNext/AndroidChart"
credentials {
username = System.getenv("GITHUBACTOR")
password = System.getenv("GITHUBTOKEN")
}
}
}
}
dependencies {
implementation "info.appdevnext:chart:$latestVersion"
}
```

<br/>

Expand Down

0 comments on commit a3cea04

Please sign in to comment.