This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from SURFnet/feature/TIQR-211_maven_accessibl…
…e_core Tiqr 211: Make core and data accessible through maven central
- Loading branch information
Showing
3 changed files
with
232 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_dispatch: # Allow manually triggering this workflow | ||
release: | ||
# We'll run this workflow when a new GitHub release is created | ||
types: [released] | ||
|
||
jobs: | ||
my-job: | ||
publish: | ||
name: Release build and publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: my-step | ||
run: echo "Hello World!" | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
# Builds the release artifacts of the library | ||
- name: Release build | ||
run: ./gradlew :tiqr-client-android:assembleRelease | ||
|
||
# Generates other artifacts | ||
- name: Source jar | ||
run: ./gradlew androidSourcesJar | ||
|
||
# Runs upload, and then closes & releases the repository | ||
- name: Publish to MavenCentral | ||
run: ./gradlew publishMavenAndroidPublicationToSonatypeRepository --max-workers 1 | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import java.util.Properties | ||
|
||
plugins { | ||
id("com.android.library") | ||
kotlin("android") | ||
kotlin("kapt") | ||
id("kotlin-parcelize") | ||
id("dagger.hilt.android.plugin") | ||
id("androidx.navigation.safeargs.kotlin") | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
android { | ||
|
@@ -47,6 +51,17 @@ android { | |
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
fun loadCustomProperties(file: File): java.util.Properties { | ||
val properties = Properties() | ||
if (file.isFile) { | ||
properties.load(file.inputStream()) | ||
} | ||
return properties | ||
} | ||
|
||
val secureProperties = loadCustomProperties(file("../local.properties")) | ||
|
||
dependencies { | ||
implementation(libs.kotlin.stdlib) | ||
|
@@ -96,7 +111,93 @@ android { | |
androidTestImplementation(libs.androidx.testing.uiautomator) | ||
androidTestImplementation(libs.kotlinx.coroutines.test) | ||
|
||
androidTestImplementation(libs.dagger.hilt.testing) | ||
kaptAndroidTest(libs.dagger.hilt.compiler) | ||
androidTestImplementation(libs.dagger.hilt.testing) | ||
kaptAndroidTest(libs.dagger.hilt.compiler) | ||
} | ||
|
||
group = "org.tiqr" | ||
version = "0.0.7-SNAPSHOT" | ||
|
||
tasks { | ||
register("sourcesJar", Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(android.sourceSets.getByName("main").java.srcDirs) | ||
} | ||
} | ||
publishing { | ||
publications { | ||
register<MavenPublication>("mavenAndroid") { | ||
artifactId = "core" | ||
|
||
afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } | ||
artifact(tasks.getByName("sourcesJar")) | ||
|
||
pom { | ||
name.set("core") | ||
url.set("https://github.com/SURFnet/tiqr-app-core-android") | ||
description.set("refactoring original tiqr project") | ||
developers { | ||
developer { | ||
name.set("sara hachem") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
name.set("Dmitry Kovalenko") | ||
email.set("[email protected]") | ||
} | ||
} | ||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
scm { | ||
connection.set("https://github.com/SURFnet/tiqr-app-core-android.git") | ||
url.set("https://github.com/SURFnet/tiqr-app-core-android") | ||
} | ||
|
||
withXml { | ||
fun groovy.util.Node.addDependency(dependency: Dependency, scope: String) { | ||
appendNode("dependency").apply { | ||
appendNode("groupId", dependency.group) | ||
appendNode("artifactId", dependency.name) | ||
appendNode("version", dependency.version) | ||
appendNode("scope", scope) | ||
} | ||
} | ||
|
||
asNode().appendNode("dependencies").let { dependencies -> | ||
// List all "api" dependencies as "compile" dependencies | ||
configurations.api.get().allDependencies.forEach { | ||
dependencies.addDependency(it, "compile") | ||
} | ||
// List all "implementation" dependencies as "runtime" dependencies | ||
configurations.implementation.get().allDependencies.forEach { | ||
dependencies.addDependency(it, "runtime") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "sonatype" | ||
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
val snapshotRepo = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") | ||
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotRepo else releasesRepoUrl) | ||
credentials { | ||
username = secureProperties.getProperty("USERNAME") | ||
password =secureProperties.getProperty("PASSWORD") | ||
} | ||
} | ||
} | ||
|
||
|
||
signing { | ||
useGpgCmd() | ||
sign(publishing.publications["mavenAndroid"]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
import java.util.Properties | ||
|
||
plugins { | ||
id("com.android.library") | ||
kotlin("android") | ||
kotlin("kapt") | ||
id("kotlin-parcelize") | ||
id("dagger.hilt.android.plugin") | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
val secureProperties = loadCustomProperties(file("../local.properties")) | ||
|
||
fun loadCustomProperties(file: File): java.util.Properties { | ||
val properties = Properties() | ||
if (file.isFile) { | ||
properties.load(file.inputStream()) | ||
} | ||
return properties | ||
} | ||
|
||
android { | ||
|
@@ -96,3 +110,90 @@ android { | |
androidTestImplementation(libs.kotlinx.coroutines.test) | ||
} | ||
} | ||
|
||
group = "org.tiqr" | ||
version = "0.0.3-SNAPSHOT" | ||
|
||
tasks { | ||
register("sourcesJar", Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(android.sourceSets.getByName("main").java.srcDirs) | ||
} | ||
} | ||
publishing { | ||
publications { | ||
register<MavenPublication>("mavenAndroid") { | ||
artifactId = "data" | ||
|
||
afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } | ||
artifact(tasks.getByName("sourcesJar")) | ||
|
||
pom { | ||
name.set("data") | ||
url.set("https://github.com/SURFnet/tiqr-app-core-android") | ||
description.set("refactoring original tiqr project") | ||
developers { | ||
developer { | ||
name.set("sara hachem") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
name.set("Dmitry Kovalenko") | ||
email.set("[email protected]") | ||
} | ||
} | ||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
scm { | ||
connection.set("https://github.com/SURFnet/tiqr-app-core-android.git") | ||
url.set("https://github.com/SURFnet/tiqr-app-core-android") | ||
} | ||
|
||
withXml { | ||
fun groovy.util.Node.addDependency(dependency: Dependency, scope: String) { | ||
appendNode("dependency").apply { | ||
appendNode("groupId", dependency.group) | ||
appendNode("artifactId", dependency.name) | ||
appendNode("version", dependency.version) | ||
appendNode("scope", scope) | ||
} | ||
} | ||
|
||
asNode().appendNode("dependencies").let { dependencies -> | ||
// List all "api" dependencies as "compile" dependencies | ||
configurations.api.get().allDependencies.forEach { | ||
dependencies.addDependency(it, "compile") | ||
} | ||
// List all "implementation" dependencies as "runtime" dependencies | ||
configurations.implementation.get().allDependencies.forEach { | ||
dependencies.addDependency(it, "runtime") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "sonatype" | ||
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
val snapshotRepo = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") | ||
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotRepo else releasesRepoUrl) | ||
credentials { | ||
username = secureProperties.getProperty("USERNAME") | ||
password =secureProperties.getProperty("PASSWORD") | ||
} | ||
} | ||
} | ||
|
||
|
||
signing { | ||
useGpgCmd() | ||
sign(publishing.publications["mavenAndroid"]) | ||
} | ||
} |