Skip to content

Commit a56d38f

Browse files
authored
Merge pull request #3 from regulaforensics/maven-publish
Publish to maven on github releases
2 parents 84b4af6 + 8ab99e6 commit a56d38f

File tree

5 files changed

+73
-3
lines changed

5 files changed

+73
-3
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: publish maven package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-java@v1
13+
with:
14+
java-version: 11
15+
java-package: jdk
16+
- run: ./gradlew clean :client:publishClientPublicationToRegulaforensicsRepository
17+
env:
18+
ORG_GRADLE_PROJECT_version: ${{ github.event.release.name }}
19+
ORG_GRADLE_PROJECT_regulaforensicsMavenUser: ${{secrets.MAVEN_PUBLISH_USER}}
20+
ORG_GRADLE_PROJECT_regulaforensicsMavenPassword: ${{secrets.MAVEN_PUBLISH_PASSWORD}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.gradle
22
.idea
33
build
4+
gradle.properties

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ You are invited to contribute [new features, fixes, or updates](https://github.c
1212

1313

1414
## Install package
15-
tbd maven deploy
15+
Add __Regula Forensics, Inc.__ maven repository to repositories section in your `build.gradle`,
16+
and declare client as regular dependency.
17+
18+
```gradle
19+
repositories {
20+
maven {
21+
url = uri("https://maven.regulaforensics.com/RegulaDocumentReaderWebClient")
22+
}
23+
}
24+
25+
dependencies {
26+
implementation("com.regula.documentreader:webclient:5.2.0")
27+
}
28+
```
1629

1730
## Example
1831
Performing request:

build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ plugins {
55
}
66

77
allprojects {
8-
group = "com.regulaforensics.docreader"
9-
version = "5.1.0"
8+
group = "com.regula.documentreader"
109

1110
repositories {
1211
jcenter()

client/build.gradle.kts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
plugins {
22
java
33
id("com.github.sherter.google-java-format") version "0.9"
4+
id("maven-publish")
45
}
56

67
java {
78
sourceCompatibility = JavaVersion.VERSION_1_7
89
targetCompatibility = JavaVersion.VERSION_1_7
10+
withSourcesJar()
911
}
1012

1113
sourceSets.main {
@@ -22,3 +24,38 @@ dependencies {
2224
implementation("javax.annotation:javax.annotation-api:1.3.2")
2325
implementation("com.google.code.findbugs:jsr305:3.0.2")
2426
}
27+
28+
/* ----------- Publishing config ------------------- */
29+
// supressed for local development
30+
// if you need to publish from local machine, create `gradle.properties` file in a project root and add 3 vairables:
31+
// - version
32+
// - regulaforensicsMavenUser
33+
// - regulaforensicsMavenPassword
34+
if (project.hasProperty("regulaforensicsMavenUser")) {
35+
36+
val regulaforensicsMavenPassword: String by project
37+
val regulaforensicsMavenUser: String by project
38+
39+
publishing {
40+
publications {
41+
create<MavenPublication>("client") {
42+
artifactId = "webclient"
43+
from(components["java"])
44+
}
45+
}
46+
repositories {
47+
maven {
48+
49+
val releasesRepoUrl = uri("sftp://maven.regulaforensics.com:22/RegulaDocumentReaderWebClient")
50+
val betaRepoUrl = uri("sftp://maven.regulaforensics.com:22/RegulaDocumentReaderWebClient/Beta")
51+
52+
name = "regulaforensics"
53+
url = if (version.toString().contains("beta")) betaRepoUrl else releasesRepoUrl
54+
credentials {
55+
username = regulaforensicsMavenUser
56+
password = regulaforensicsMavenPassword
57+
}
58+
}
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)