-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Don't infer version from CI env * Add sonatype publishing
- Loading branch information
Showing
5 changed files
with
175 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,81 @@ | ||
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | ||
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle | ||
# This workflow will build a package using Gradle and then publish it to maven | ||
|
||
name: Kotlin CI | ||
|
||
name: Deployment | ||
on: | ||
release: | ||
types: [created] | ||
push: | ||
paths: | ||
- '**.gradle' | ||
- '**.properties' | ||
- '**/src/**' | ||
branches: | ||
- 'master' | ||
- '0.7.x' | ||
- '0.8.x' | ||
tags-ignore: | ||
- '*.*' | ||
pull_request: | ||
paths: | ||
- '**.gradle' | ||
- '**.properties' | ||
- '**/src/**' | ||
types: [ opened, synchronize, reopened ] | ||
|
||
jobs: | ||
deploy: | ||
build: | ||
name: Build Kord | ||
runs-on: ubuntu-latest | ||
env: | ||
KORD_TEST_TOKEN: ${{ secrets.KORD_TEST_TOKEN }} | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Build with Gradle | ||
run: ./gradlew --stacktrace --info build | ||
if: | | ||
!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.pull_request.title, '[ci skip]') | ||
release: | ||
name: Publish artifacts | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'pull_request' | ||
needs: build | ||
env: | ||
KORD_TEST_TOKEN: ${{ secrets.KORD_TEST_TOKEN }} | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | ||
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} | ||
BINTRAY_USER: ${{ secrets.BINTRAY_USER }} | ||
NEXUS_USER: ${{ secrets.NEXUS_USER }} | ||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: echo "name=RELEASE_TAG::${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- name: Set up JDK 1.8 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Build with Gradle | ||
run: gradle --stacktrace --info bintrayUpload | ||
java-version: 8 | ||
- name: Publish with Gradle | ||
run: ./gradlew -x test publish | ||
# Disabled for now | ||
# | ||
# - name: Close and Release Repository | ||
# run: ./gradlew closeAndReleaseRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ buildscript { | |
|
||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}") | ||
classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlin}") | ||
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintray}") | ||
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Versions.atomicFu}") | ||
classpath("org.jetbrains.kotlinx:binary-compatibility-validator:${Versions.binaryCompatibilityValidator}") | ||
} | ||
|
@@ -24,12 +23,16 @@ plugins { | |
id("org.jetbrains.kotlin.jvm") version Versions.kotlin | ||
id("org.jetbrains.dokka") version "1.4.0" | ||
id("org.ajoberstar.git-publish") version "2.1.3" | ||
id("com.jfrog.bintray") version "1.8.5" | ||
|
||
signing | ||
`maven-publish` | ||
id("io.codearte.nexus-staging") version "0.22.0" | ||
} | ||
|
||
apply(plugin = "binary-compatibility-validator") | ||
|
||
repositories { | ||
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev/") | ||
mavenCentral() | ||
jcenter() | ||
mavenLocal() | ||
|
@@ -50,6 +53,7 @@ subprojects { | |
apply(plugin = "maven-publish") | ||
apply(plugin = "kotlinx-atomicfu") | ||
apply(plugin = "org.jetbrains.dokka") | ||
apply(plugin = "signing") | ||
|
||
repositories { | ||
mavenCentral() | ||
|
@@ -76,7 +80,7 @@ subprojects { | |
testRuntimeOnly(Dependencies.sl4j) | ||
} | ||
|
||
tasks.getByName("apiCheck").onlyIf { Library.stableApi } | ||
tasks.getByName("apiCheck").onlyIf { Library.isStableApi } | ||
|
||
val compileKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks | ||
compileKotlin.kotlinOptions.jvmTarget = Jvm.target | ||
|
@@ -114,25 +118,99 @@ subprojects { | |
from(sourceSets.main.get().allSource) | ||
} | ||
|
||
val dokkaJar by tasks.registering(Jar::class) { | ||
group = JavaBasePlugin.DOCUMENTATION_GROUP | ||
description = "Assembles Kotlin docs with Dokka" | ||
archiveClassifier.set("javadoc") | ||
from(tasks.dokkaHtml) | ||
dependsOn(tasks.dokkaHtml) | ||
} | ||
|
||
apply<BintrayPlugin>() | ||
|
||
configure<PublishingExtension> { | ||
publishing { | ||
publications { | ||
register("kord", MavenPublication::class) { | ||
create<MavenPublication>(Library.name) { | ||
from(components["kotlin"]) | ||
groupId = Library.group | ||
artifactId = "kord-${project.name}" | ||
version = Library.version | ||
|
||
artifact(sourcesJar.get()) | ||
artifact(dokkaJar.get()) | ||
|
||
pom { | ||
name.set(Library.name) | ||
description.set(Library.description) | ||
url.set(Library.description) | ||
|
||
organization { | ||
name.set("Kord") | ||
url.set("https://github.com/kordlib") | ||
} | ||
|
||
developers { | ||
developer { | ||
name.set("The Kord Team") | ||
} | ||
} | ||
|
||
issueManagement { | ||
system.set("GitHub") | ||
url.set("https://github.com/kordlib/kord/issues") | ||
} | ||
|
||
withXml { | ||
val repoNode = asNode().appendNode("repositories").appendNode("repository") | ||
|
||
with(repoNode) { | ||
appendNode("id", "jcenter") | ||
appendNode("name", "jcenter-bintray") | ||
appendNode("url", "https://jcenter.bintray.com") | ||
} | ||
} | ||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:ssh://github.com/kordlib/kord.git") | ||
developerConnection.set("scm:git:ssh://[email protected]:kordlib/kord.git") | ||
url.set(Library.projectUrl) | ||
} | ||
} | ||
|
||
if (!isJitPack) { | ||
repositories { | ||
maven { | ||
url = if (Library.isSnapshot) uri(Repo.snapshotsUrl) | ||
else uri(Repo.releasesUrl) | ||
|
||
credentials { | ||
username = System.getenv("NEXUS_USER") | ||
password = System.getenv("NEXUS_PASSWORD") | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
if (!isJitPack) { | ||
signing { | ||
sign(publishing.publications[Library.name]) | ||
} | ||
} | ||
|
||
configure<BintrayExtension> { | ||
user = System.getenv("BINTRAY_USER") | ||
key = System.getenv("BINTRAY_KEY") | ||
setPublications("kord") | ||
setPublications(Library.name) | ||
publish = true | ||
|
||
pkg = PackageConfig().apply { | ||
|
@@ -188,3 +266,5 @@ configure<GitPublishExtension> { | |
|
||
commitMessage.set("Update Docs") | ||
} | ||
|
||
nexusStaging { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters