Skip to content

Commit

Permalink
Publish to maven central (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
raniejade committed Feb 14, 2021
1 parent 1f58a57 commit 4078fcd
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 212 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
arguments: spek-dsl:bintrayUpload spek-runtime:bintrayUpload spek-runner-junit5:bintrayUpload --stacktrace -PexcludeIdePlugins
arguments: spek-dsl:publish spek-runtime:publish spek-runner-junit5:publish --stacktrace -PexcludeIdePlugins
- os: windows-latest
arguments: spek-dsl:bintrayUpload spek-runtime:bintrayUpload --stacktrace -PexcludeIdePlugins
arguments: spek-dsl:publish spek-runtime:publish --stacktrace -PexcludeIdePlugins
- os: macos-latest
arguments: spek-dsl:bintrayUpload spek-runtime:bintrayUpload --stacktrace -PexcludeIdePlugins
arguments: spek-dsl:publish spek-runtime:publish --stacktrace -PexcludeIdePlugins
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -36,8 +36,10 @@ jobs:
with:
arguments: ${{ matrix.arguments }}
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_SIGNING_KEY: ${{ secrets.OSSRH_SIGNING_KEY }}
OSSRH_SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }}

deploy_ij_plugin:
strategy:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/spekframework/spek/CI?style=flat-square)](https://github.com/spekframework/spek/actions?query=workflow%3ACI)
[ ![Download](https://img.shields.io/badge/dynamic/json.svg?label=stable&url=https%3A%2F%2Fapi.bintray.com%2Fpackages%2Fspekframework%2Fspek%2Fspek2%2Fversions%2F_latest&query=name&colorB=blue) ](https://bintray.com/spekframework/spek/spek2/_latestVersion)
[ ![Download](https://img.shields.io/badge/dynamic/json.svg?label=dev&url=https%3A%2F%2Fapi.bintray.com%2Fpackages%2Fspekframework%2Fspek-dev%2Fspek2%2Fversions%2F_latest&query=name&colorB=blue) ](https://bintray.com/spekframework/spek-dev/spek2/_latestVersion)
![Maven Central](https://img.shields.io/maven-central/v/org.spekframework.spek2/spek-dsl-jvm?style=flat-square)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/org.spekframework.spek2/spek-dsl-jvm?server=https%3A%2F%2Foss.sonatype.org&style=flat-square)

![Spek Logo](spek-logo.png)

Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ allprojects {
var releaseMode = false
if ("$version".matches(Regex("^\\d+\\.\\d+\\.\\d+(-rc\\.\\d+)?"))) {
releaseMode = true
} else {
version = "$version-SNAPSHOT"
}
project.extra["releaseMode"] = releaseMode

Expand Down
57 changes: 35 additions & 22 deletions buildSrc/src/main/kotlin/publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
plugins {
id("com.jfrog.bintray")
`maven-publish` apply false
`maven-publish`
signing
}

val bintrayUser = propOrEnv("BINTRAY_USER")
val bintrayApiKey = propOrEnv("BINTRAY_API_KEY")

var bintrayRepo = "spek-dev"
var doPublish = true

var releaseMode = project.extra["releaseMode"] == true

if (project.extra["releaseMode"] == true) {
bintrayRepo = "spek"
doPublish = false
}

val artifacts = project.extra["artifacts"] as Array<String>
bintray {
user = bintrayUser
key = bintrayApiKey
publish = doPublish
with(pkg) {
repo = bintrayRepo
desc = "Test framework for Kotlin"
name = "spek2"
userOrg = "spekframework"
setLicenses("BSD New")
setLabels("kotlin", "testing")
vcsUrl = "https://github.com/spekframework/spek.git"
githubRepo = "spekframework/spek"
with(version) {
name = rootProject.version.toString()
val artifacts = (project.extra["artifacts"] as Array<String>).toHashSet()

tasks.withType<AbstractPublishToMaven>()
.configureEach {
onlyIf {
artifacts.contains(publication.name)
}
}

setPublications(*artifacts)
signing {
val signingKey = propOrEnv("OSSRH_SIGNING_KEY")
val signingPassword = propOrEnv("OSSRH_SIGNING_PASSWORD")
useInMemoryPgpKeys(signingKey, signingPassword)
publishing.publications.all {
if (artifacts.contains(name)) {
sign(this)
}
}
}

publishing {
repositories {
maven {
val targetRepo = if (releaseMode) {
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
"https://oss.sonatype.org/content/repositories/snapshots/"
}
setUrl(targetRepo)

credentials {
username = propOrEnv("OSSRH_USERNAME")
password = propOrEnv("OSSRH_PASSWORD")
}
}
}

publications {
all {
if (this is MavenPublication) {
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[ ![CI](https://travis-ci.com/spekframework/spek.svg?branch=2.x) ](https://travis-ci.com/spekframework/spek)
[ ![Download](https://img.shields.io/badge/dynamic/json.svg?label=stable&url=https%3A%2F%2Fapi.bintray.com%2Fpackages%2Fspekframework%2Fspek%2Fspek2%2Fversions%2F_latest&query=name&colorB=blue) ](https://bintray.com/spekframework/spek/spek2/_latestVersion)
[ ![Download](https://img.shields.io/badge/dynamic/json.svg?label=dev&url=https%3A%2F%2Fapi.bintray.com%2Fpackages%2Fspekframework%2Fspek-dev%2Fspek2%2Fversions%2F_latest&query=name&colorB=blue) ](https://bintray.com/spekframework/spek-dev/spek2/_latestVersion)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/spekframework/spek/CI?style=flat-square)](https://github.com/spekframework/spek/actions?query=workflow%3ACI)
![Maven Central](https://img.shields.io/maven-central/v/org.spekframework.spek2/spek-dsl-jvm?style=flat-square)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/org.spekframework.spek2/spek-dsl-jvm?server=https%3A%2F%2Foss.sonatype.org&style=flat-square)

Spek `2.x` is a complete rewrite of Spek with Kotlin multiplatform support in mind. The DSL is also reworked into
two distinct styles: [specification](specification.md) and [gherkin](gherkin.md).
Expand Down
39 changes: 0 additions & 39 deletions gradle/common/dependencies.gradle

This file was deleted.

19 changes: 0 additions & 19 deletions gradle/common/idea-plugin.gradle

This file was deleted.

24 changes: 0 additions & 24 deletions gradle/common/kotlin-common.gradle

This file was deleted.

28 changes: 0 additions & 28 deletions gradle/common/kotlin-jvm.gradle

This file was deleted.

20 changes: 0 additions & 20 deletions gradle/common/publish-plugin.gradle

This file was deleted.

42 changes: 0 additions & 42 deletions gradle/common/publish.gradle

This file was deleted.

6 changes: 0 additions & 6 deletions gradle/common/versioning.gradle

This file was deleted.

4 changes: 2 additions & 2 deletions spek-ide-plugin-intellij-idea/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ val buildMatrix = mapOf(
arrayOf("java", "org.jetbrains.kotlin:1.3.50-release-IJ2019.2-1")
),
"IJ201" to ij.BuildConfig(
"201-EAP-SNAPSHOT",
"201.8743.12",
"IJ2020.1",
"IJ183",
ij.VersionRange("201.1", "201.*"),
arrayOf("java", "org.jetbrains.kotlin:1.3.61-release-IJ2019.3-1")
),
"IJ202" to ij.BuildConfig(
"202-EAP-SNAPSHOT",
"202.8194.7",
"IJ2020.2",
"IJ183",
ij.VersionRange("202.1", "202.*"),
Expand Down

0 comments on commit 4078fcd

Please sign in to comment.