Skip to content

Commit

Permalink
upgrade kotlin and gradle
Browse files Browse the repository at this point in the history
prepare for maven central release
  • Loading branch information
exaV authored and Patrick Del Conte committed Mar 4, 2022
1 parent 3ebf6f9 commit ee2e60f
Show file tree
Hide file tree
Showing 11 changed files with 796 additions and 193 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,16 @@
name: Build and test
on: [push]
jobs:
build-and-run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew build
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,22 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build and publish
run: ./gradlew -Pversion=${{github.ref_name}} publish
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_URL: https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -11,10 +11,10 @@ Start here: https://github.com/exaV/screeps-kotlin-starter

``` Kotlin
repositories {
url("https://jitpack.io")
mavenCentral()
}
dependencies {
implementation("com.github.exaV:screeps-kotlin-types:<version or commit hash>")
implementation("io.github.exaV:screeps-kotlin-types:<version>")
}

```
Expand Down
75 changes: 36 additions & 39 deletions build.gradle.kts
@@ -1,22 +1,18 @@
import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import org.gradle.api.publish.maven.internal.artifact.FileBasedMavenArtifact

plugins {
kotlin("js") version "1.4.10"
kotlin("js") version "1.6.10"
`maven-publish`
id("com.jfrog.bintray") version "1.8.5"
}

group = "io.github.exav"

repositories {
jcenter()
mavenCentral()
}

dependencies {
testImplementation(kotlin("test-js"))
}

group = "ch.delconte.screeps-kotlin"

kotlin {
js(BOTH) {
Expand All @@ -27,44 +23,45 @@ kotlin {


publishing {

publications {
register<MavenPublication>("kotlin") {
from(components["kotlin"])
artifact(tasks.getByName<Zip>("jsLegacySourcesJar"))
}
}
}

val bintrayUser: String? by project
val bintrayApiKey: String? by project

tasks.withType<BintrayUploadTask> {
doFirst {
publishing.publications
.filterIsInstance<MavenPublication>()
.forEach { publication ->
val moduleFile = buildDir.resolve("publications/${publication.name}/module.json")
if (moduleFile.exists()) {
publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
override fun getDefaultExtension() = "module"
})
pom {
name.set("screeps-kotlin-types")
description.set("The repository for Screep's Kotlin type definitions. https://screeps.com/")
url.set("https://github.com/exaV/screeps-kotlin-types")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/mit-license.php")
}
}
scm {
connection.set("scm:git:git://github.com/exaV/screeps-kotlin-types.git")
developerConnection.set("scm:git:ssh://github.com/exaV/screeps-kotlin-types.git")
url.set("https://github.com/exaV/screeps-kotlin-types")
}
developers {
developer {
name.set("Patrick Del Conte")
organizationUrl.set("https://github.com/exaV")
}
}
}

}
}
}

bintray {
user = bintrayUser ?: ""
key = bintrayApiKey ?: ""
publish = true
setPublications("kotlin")
pkg(delegateClosureOf<BintrayExtension.PackageConfig> {
repo = "screeps-kotlin"
name = "screeps-kotlin-types"
websiteUrl = "https://github.com/exaV/screeps-kotlin-types"
githubRepo = "exaV/screeps-kotlin-types"
vcsUrl = "https://github.com/exaV/screeps-kotlin-types"
setLabels("kotlin")
setLicenses("MIT")
})
repositories {
maven {
url = uri(System.getenv("MAVEN_URL") ?: "")
credentials {
username = System.getenv("MAVEN_USERNAME") ?: ""
password = System.getenv("MAVEN_PASSWORD") ?: ""
}
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit ee2e60f

Please sign in to comment.