diff --git a/.gitignore b/.gitignore index 549d5ba..250b6f5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ gen/ out/ target/ local.properties +github.properties classes/ tmp/ project.properties diff --git a/githubpackages.gradle b/githubpackages.gradle new file mode 100644 index 0000000..5db3eb7 --- /dev/null +++ b/githubpackages.gradle @@ -0,0 +1,41 @@ +def githubProperties = new Properties() +githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) + +publishing { + publications { + ReportingLibPublication(MavenPublication) { + artifact("$buildDir/outputs/aar/opensrp-reporting-debug.aar") + artifact(sourceJar) + groupId this.group + artifactId 'opensrp-client-reporting' + version this.version + + //The publication doesn't know about our dependencies, so we have to manually add them to the pom + pom.withXml { + def dependenciesNode = asNode().appendNode('dependencies') + //Iterate over the compile dependencies (we don't want the test ones), adding a node for each + configurations.implementation.allDependencies.each { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', it.group) + dependencyNode.appendNode('artifactId', it.name) + dependencyNode.appendNode('version', it.version) + } + } + } + } + + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/opensrp/opensrp-client-reporting") + credentials { + /** Create github.properties in root project folder file with + ** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN + ** Or set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/ + // SC user token + username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER") + password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY") + } + } + } +} \ No newline at end of file diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index 83cc1e1..a68fe50 100644 --- a/opensrp-reporting/build.gradle +++ b/opensrp-reporting/build.gradle @@ -169,4 +169,5 @@ coveralls { } apply from: '../maven.gradle' -// apply from: '../bintray.gradle' \ No newline at end of file +// apply from: '../bintray.gradle' +apply from: '../githubpackages.gradle' \ No newline at end of file