Skip to content

Commit

Permalink
Merge pull request #163 from VirtusLab/publish-to-bintray
Browse files Browse the repository at this point in the history
Automate releses of artifacts
  • Loading branch information
BarkingBad authored Feb 3, 2021
2 parents f219691 + 8b422be commit ff7924b
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 119 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/bintray_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Gradle Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout Inkuire
uses: actions/checkout@v2
with:
path: inkuire

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Build with sbt
run: sbt test

- name: Compile Inkuire to JavaScript
run: sbt engineJS/fastOptJS
working-directory: ./inkuire

- name: Build with Gradle
run: gradle build

- name: Upload to Bintray Gradle artifacts
run: gradle bintrayUpload
env:
ORG_GRADLE_PROJECT_bintrayUser: ${{ secrets.BINTRAY_USER }}
ORG_GRADLE_PROJECT_bintrayKey: ${{ secrets.BINTRAY_PASS }}

- name: Upload to Bintray sbt artifacts
run: sbt publish
env:
ORG_GRADLE_PROJECT_bintrayUser: ${{ secrets.BINTRAY_USER }}
ORG_GRADLE_PROJECT_bintrayKey: ${{ secrets.BINTRAY_PASS }}
16 changes: 15 additions & 1 deletion .github/workflows/s3-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ jobs:
with:
java-version: 11

- name: Read dokka_version
id: dokka_version
uses: christian-draeger/[email protected]
with:
path: './inkuire/gradle.properties'
property: 'dokkaVersion'

- name: Read inkuire_version
id: inkuire_version
uses: christian-draeger/[email protected]
with:
path: './inkuire/global.properties'
property: 'version'

- name: Compile Inkuire to JavaScript
run: sbt engineJS/fullOptJS
working-directory: ./inkuire
Expand All @@ -35,7 +49,7 @@ jobs:
path: stdlib

- name: Create database from stdlib
run: ./gradlew clean extractAll cleanupSources dokkaStdlib --stacktrace
run: ./gradlew clean extractAll cleanupSources dokkaStdlib --stacktrace -Pdokka_version=${{ steps.dokka_version.outputs.value }} -Pinkuire_version=${{ steps.inkuire_version.outputs.value }}
working-directory: ./stdlib

- name: Configure AWS credentials for S3 access
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ EngineJS:
If you want to generate Dokka documentation with embedded Inkuire search engine, add this line to `build.gradle` dependencies block:
```Kotlin
dependencies {
dokkaPlugin("org.virtuslab:inkuire-html-extension:0.1.0")
dokkaPlugin("org.virtuslab:inkuire-html-extension:0.1.1")
}
```

Engine HTTP:
If you want to generate only Inkuire db files, add this line to `build.gradle` dependencies block:
```Kotlin
dependencies {
dokkaPlugin("org.virtuslab:inkuire-db-generator:0.1.0")
dokkaPlugin("org.virtuslab:inkuire-db-generator:0.1.1")
}
```

Expand Down
29 changes: 26 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
group = "org.virtuslab"
version = "1.0-SNAPSHOT"

plugins {
kotlin("jvm") apply false
id("com.jfrog.bintray")
}

val globalProperties = java.util.Properties()
file("global.properties").inputStream().run {
globalProperties.load(this)
}

subprojects {
apply {
plugin("org.jetbrains.kotlin.jvm")
plugin("com.jfrog.bintray")
}

group = "org.virtuslab.inkuire"
version = globalProperties.getProperty("version")

repositories {
jcenter()
}
Expand All @@ -33,4 +40,20 @@ subprojects {
classpath = ktlint
args = listOf("-F", "src/**/*.kt")
}

bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_PASS")
setPublications("MavenJava")
publish = true
pkg(delegateClosureOf<com.jfrog.bintray.gradle.BintrayExtension.PackageConfig> {
repo = "Inkuire"
userOrg = "virtuslab"
name = project.name
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/VirtusLab/Inkuire.git"
})
}
}


54 changes: 46 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import java.io.FileInputStream
import java.util.Properties

ThisBuild / organization := "org.virtuslab.inkuire"

name := "inkuire"

skip in publish := true
ThisBuild / scalaVersion := "2.13.3"

val fileInputStream = new FileInputStream(new File("global.properties"))
val globalProperties = new Properties()
val _ = globalProperties.load(fileInputStream) // :')
val inkuireVersion = globalProperties.getProperty("version")

val http4sVersion = "0.21.0"

val catsDependency = settingKey[Seq[ModuleID]]("Dependency to cats library")
Expand Down Expand Up @@ -36,36 +44,57 @@ ThisBuild / circeDependency := Seq(
lazy val commonScalaRoot = project
.in(file("./commonScala"))
.aggregate(commonScala.js, commonScala.jvm)
.settings(
name := "common-scala-root",
version := inkuireVersion,
bintrayRepository := "Inkuire",
bintrayOrganization := Some("virtuslab"),
licenses ++= Seq(("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0")))
)

lazy val commonScala = crossProject(JSPlatform, JVMPlatform)
.in(file("./commonScala"))
.settings(
name := "inkuire-common-scala",
version := "0.1-SNAPSHOT",
libraryDependencies ++= circeDependency.value
name := "common-scala",
version := inkuireVersion,
libraryDependencies ++= circeDependency.value,
bintrayRepository := "Inkuire",
bintrayOrganization := Some("virtuslab"),
licenses ++= Seq(("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0")))
)

lazy val engineCommonRoot = project
.in(file("./engineCommon"))
.aggregate(engineCommon.js, engineCommon.jvm)
.settings(
name := "engine-common-root",
version := inkuireVersion,
bintrayRepository := "Inkuire",
bintrayOrganization := Some("virtuslab"),
licenses ++= Seq(("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0")))
)

lazy val engineCommon = crossProject(JSPlatform, JVMPlatform)
.in(file("./engineCommon"))
.settings(
name := "inkuire-engine-common",
version := "0.1-SNAPSHOT",
name := "engine-common",
version := inkuireVersion,
libraryDependencies ++= Seq(
"com.softwaremill.quicklens" %%% "quicklens" % "1.6.1",
"io.scalaland" %%% "chimney" % "0.6.0",
"org.scala-lang.modules" %%% "scala-parser-combinators" % "1.1.2",
"com.softwaremill.diffx" %%% "diffx-scalatest" % "0.3.29" % Test
) ++ circeDependency.value ++ catsDependency.value
) ++ circeDependency.value ++ catsDependency.value,
bintrayRepository := "Inkuire",
bintrayOrganization := Some("virtuslab"),
licenses ++= Seq(("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0")))
)
.dependsOn(commonScala)

lazy val engineHttp = project
.in(file("./engineHttp"))
.settings(
name := "engine-http",
libraryDependencies ++= Seq(
"com.softwaremill.quicklens" %% "quicklens" % "1.5.0",
"com.softwaremill.diffx" %% "diffx-core" % "0.3.28",
Expand All @@ -88,6 +117,10 @@ lazy val engineHttp = project
"org.scalatest" %% "scalatest" % "3.2.2" % Test,
"com.softwaremill.diffx" %% "diffx-scalatest" % "0.3.28" % Test
),
version := inkuireVersion,
bintrayRepository := "Inkuire",
bintrayOrganization := Some("virtuslab"),
licenses ++= Seq(("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0"))),
mainClass in assembly := Some("org.virtuslab.inkuire.engine.http.Main")
)
.dependsOn(engineCommon.jvm)
Expand All @@ -96,6 +129,7 @@ lazy val engineJS = project
.in(file("./engineJs"))
.enablePlugins(ScalaJSPlugin)
.settings(
name := "engine-js",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client" %%% "core" % "2.2.9",
"org.typelevel" %%% "cats-core" % "2.2.0",
Expand All @@ -107,6 +141,10 @@ lazy val engineJS = project
"io.monix" %%% "monix" % "3.2.2",
"io.monix" %%% "monix-reactive" % "3.2.2"
),
scalaJSUseMainModuleInitializer := true
scalaJSUseMainModuleInitializer := true,
version := inkuireVersion,
bintrayRepository := "Inkuire",
bintrayOrganization := Some("virtuslab"),
licenses ++= Seq(("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0")))
)
.dependsOn(engineCommon.js)
5 changes: 1 addition & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ plugins {
`maven-publish`
}

group = "org.virtuslab"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
}
Expand All @@ -25,7 +22,7 @@ tasks {

publishing {
publications {
register<MavenPublication>("common") {
register<MavenPublication>("MavenJava") {
artifactId = "inkuire-common"
from(components["java"])
}
Expand Down
5 changes: 1 addition & 4 deletions dokka-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ plugins {
`maven-publish`
}

group = "org.virtuslab"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
jcenter()
Expand All @@ -29,7 +26,7 @@ dependencies {

publishing {
publications {
register<MavenPublication>("dokkaCommon") {
register<MavenPublication>("MavenJava") {
artifactId = "inkuire-dokka-common"
from(components["java"])
}
Expand Down
5 changes: 1 addition & 4 deletions dokka-common/db-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ plugins {
`maven-publish`
}

group = "org.virtuslab"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
jcenter()
Expand Down Expand Up @@ -32,7 +29,7 @@ dependencies {

publishing {
publications {
register<MavenPublication>("dbGenerator") {
register<MavenPublication>("MavenJava") {
artifactId = "inkuire-db-generator"
from(components["java"])
}
Expand Down
11 changes: 4 additions & 7 deletions dokka-common/dokka-html-inkuire-extension/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ plugins {
`maven-publish`
}

group = "org.virtuslab"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
jcenter()
Expand All @@ -30,7 +27,7 @@ dependencies {

publishing {
publications {
register<MavenPublication>("htmlExtension") {
register<MavenPublication>("MavenJava") {
artifactId = "inkuire-html-extension"
from(components["java"])
}
Expand All @@ -40,14 +37,14 @@ publishing {
val copy by tasks.creating(Copy::class) {
from("$rootDir/engineJs/target/scala-2.13/", "$rootDir/engineJs/src/main/resources")
into("$rootDir/dokka-common/dokka-html-inkuire-extension/src/main/resources/inkuire")
include("enginejs-opt.js", "inkuire-styles.css", "inkuire-search.png", "inkuire-worker.js")
include("engine-js-opt.js", "engine-js-opt.js.map", "inkuire-styles.css", "inkuire-search.png", "inkuire-worker.js")
rename("inkuire-worker.js", "scripts/inkuire-worker.js")
rename("enginejs-opt.js", "scripts/inkuire.js")
rename("engine-js-opt.js", "scripts/inkuire.js")
rename("engine-js-opt.js.map", "scripts/inkuire.js.map")
rename("inkuire-styles.css", "styles/inkuire-styles.css")
rename("inkuire-search.png", "images/inkuire-search.png")
}


tasks.withType<AbstractPublishToMaven>().configureEach {
this.dependsOn(copy)
}
Expand Down
Loading

0 comments on commit ff7924b

Please sign in to comment.