From 7866f34aa56c1d4b5a043b9585779cfa71d4a7b3 Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 4 May 2021 15:29:36 +0300 Subject: [PATCH 1/3] :see_no_evil: Add github.properties file to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 549d5ba5..250b6f57 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ gen/ out/ target/ local.properties +github.properties classes/ tmp/ project.properties From 3637c04c799bede968b2b94eac9f3b5cd85a6ec5 Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 4 May 2021 15:30:57 +0300 Subject: [PATCH 2/3] :construction: Add publish to GitHub registry gradle file --- githubpackages.gradle | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 githubpackages.gradle diff --git a/githubpackages.gradle b/githubpackages.gradle new file mode 100644 index 00000000..5db3eb70 --- /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 From 02f51c1f6d2ae11b4a7062a21b91a742233bfc48 Mon Sep 17 00:00:00 2001 From: Allan O Date: Tue, 4 May 2021 15:34:07 +0300 Subject: [PATCH 3/3] :construction: Include githubpackages.gradle file --- opensrp-reporting/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opensrp-reporting/build.gradle b/opensrp-reporting/build.gradle index 83cc1e13..a68fe50f 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