diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 00000000..9d79fd59 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,20 @@ +name: publish maven package + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 11 + java-package: jdk + - run: ./gradlew clean :client:publishClientPublicationToRegulaforensicsRepository + env: + ORG_GRADLE_PROJECT_version: ${{ github.event.release.name }} + ORG_GRADLE_PROJECT_regulaforensicsMavenUser: ${{secrets.MAVEN_PUBLISH_USER}} + ORG_GRADLE_PROJECT_regulaforensicsMavenPassword: ${{secrets.MAVEN_PUBLISH_PASSWORD}} diff --git a/.gitignore b/.gitignore index e0d53d80..4d8a649b 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .gradle .idea build +gradle.properties diff --git a/README.md b/README.md index d72bf97b..af8f80a8 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,20 @@ You are invited to contribute [new features, fixes, or updates](https://github.c ## Install package -tbd maven deploy +Add __Regula Forensics, Inc.__ maven repository to repositories section in your `build.gradle`, +and declare client as regular dependency. + +```gradle +repositories { + maven { + url = uri("https://maven.regulaforensics.com/RegulaDocumentReaderWebClient") + } +} + +dependencies { + implementation("com.regula.documentreader:webclient:5.2.0") +} +``` ## Example Performing request: diff --git a/build.gradle.kts b/build.gradle.kts index a14e3ad4..fc783f04 100755 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,7 @@ plugins { } allprojects { - group = "com.regulaforensics.docreader" - version = "5.1.0" + group = "com.regula.documentreader" repositories { jcenter() diff --git a/client/build.gradle.kts b/client/build.gradle.kts index 8cdc7065..8d2bfbdd 100755 --- a/client/build.gradle.kts +++ b/client/build.gradle.kts @@ -1,11 +1,13 @@ plugins { java id("com.github.sherter.google-java-format") version "0.9" + id("maven-publish") } java { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 + withSourcesJar() } sourceSets.main { @@ -22,3 +24,38 @@ dependencies { implementation("javax.annotation:javax.annotation-api:1.3.2") implementation("com.google.code.findbugs:jsr305:3.0.2") } + +/* ----------- Publishing config ------------------- */ +// supressed for local development +// if you need to publish from local machine, create `gradle.properties` file in a project root and add 3 vairables: +// - version +// - regulaforensicsMavenUser +// - regulaforensicsMavenPassword +if (project.hasProperty("regulaforensicsMavenUser")) { + + val regulaforensicsMavenPassword: String by project + val regulaforensicsMavenUser: String by project + + publishing { + publications { + create("client") { + artifactId = "webclient" + from(components["java"]) + } + } + repositories { + maven { + + val releasesRepoUrl = uri("sftp://maven.regulaforensics.com:22/RegulaDocumentReaderWebClient") + val betaRepoUrl = uri("sftp://maven.regulaforensics.com:22/RegulaDocumentReaderWebClient/Beta") + + name = "regulaforensics" + url = if (version.toString().contains("beta")) betaRepoUrl else releasesRepoUrl + credentials { + username = regulaforensicsMavenUser + password = regulaforensicsMavenPassword + } + } + } + } +}