Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ jobs:

release:
name: Release ${{ matrix.module }} to Sonatype
strategy:
matrix:
module: [kstore, kstore-file, kstore-storage]
if: ${{ github.event_name != 'pull_request' }}
# TODO: Remove after testing
# if: ${{ github.event_name != 'pull_request' }}
runs-on: macos-latest
needs:
- build
Expand All @@ -104,22 +102,14 @@ jobs:
- name: Setup gradle
uses: gradle/gradle-build-action@v2

- name: Write secrets to local.properties
if: ${{ github.event_name != 'pull_request' }}
run: |
echo sonatypeUsername="${SONATYPE_USERNAME}" >> "local.properties"
echo sonatypePassword="${SONATYPE_PASSWORD}" >> "local.properties"
echo gpgKeyPassword="${GPG_KEY_PASSWORD}" >> "local.properties"
echo gpgKeySecret="${GPG_KEY_SECRET}" >> "local.properties"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }}

- name: Release to sonatype
run: ./gradlew :${{ matrix.module }}:publishAllPublicationsToMavenRepository

run: ./gradlew :publishAllPublicationsToMavenCentralRepository --no-parallel --no-configuration-cache
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add --no-build-cache --rerun-tasks to force it to run on CI? @xxfast

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xxfast did that work?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the correct task to run here would be ./gradlew publishAllToMavenCentral and not publishAllPublicationsToMavenCentralRepository

https://github.com/championswimmer/KStore/blob/master/.github/workflows/build.yml#L112

env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_SECRET }}

documentation:
name: Publish documentation
Expand Down
96 changes: 30 additions & 66 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import com.vanniktech.maven.publish.MavenPublishBaseExtension

plugins {
id("org.jetbrains.kotlinx.kover") version "0.8.2"
Expand All @@ -16,91 +16,55 @@ buildscript {
classpath(libs.agp)
classpath(libs.kotlin)
classpath(libs.kotlin.serialization)
classpath(libs.vanniktech.maven.publish)
}
}

// TODO: Migrate away from allprojects
allprojects {
repositories {
google()
mavenCentral()
}

group = "io.github.xxfast"
version = "1.0.0"
version = "1.1.0-SNAPSHOT"

apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "com.vanniktech.maven.publish")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "maven-publish")
apply(plugin = "signing")

extensions.configure<PublishingExtension> {
repositories {
maven {
val isSnapshot = version.toString().endsWith("SNAPSHOT")
url = uri(
if (!isSnapshot) "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
else "https://s01.oss.sonatype.org/content/repositories/snapshots"
)
extensions.configure<MavenPublishBaseExtension> {
publishToMavenCentral()
signAllPublications()
coordinates(group.toString(), project.name, version.toString())

credentials {
username = gradleLocalProperties(rootDir).getProperty("sonatypeUsername")
password = gradleLocalProperties(rootDir).getProperty("sonatypePassword")
pom {
name = "Kstore"
description = "A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and okio"
url = "https://xxfast.github.io/KStore/"
licenses {
license {
name = "Apache-2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}

val javadocJar = tasks.register<Jar>("javadocJar") {
dependsOn(tasks.dokkaHtml)
archiveClassifier.set("javadoc")
from("$buildDir/dokka")
}

publications {
withType<MavenPublication> {
artifact(javadocJar)

pom {
name.set("KStore")
description.set("A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and okio")
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
url.set("https://xxfast.github.io/KStore/")
issueManagement {
system.set("Github")
url.set("https://github.com/xxfast/KStore/issues")
}
scm {
connection.set("https://github.com/xxfast/KStore.git")
url.set("https://github.com/xxfast/KStore")
}
developers {
developer {
name.set("Isuru Rajapakse")
email.set("isurukusumal36@gmail.com")
}
}
issueManagement {
system = "Github"
url = "https://github.com/xxfast/KStore/issues"
}
scm {
developerConnection = "scm:git:ssh://git@github.com/xxfast/KStore.git"
connection = "https://github.com/xxfast/KStore.git"
url = "https://github.com/xxfast/KStore"
}
developers {
developer {
name = "Isuru Rajapakse"
email = "isurukusumal36@gmail.com"
}
}
}
}

val publishing = extensions.getByType<PublishingExtension>()
extensions.configure<SigningExtension> {
useInMemoryPgpKeys(
gradleLocalProperties(rootDir).getProperty("gpgKeySecret"),
gradleLocalProperties(rootDir).getProperty("gpgKeyPassword"),
)

sign(publishing.publications)
}

// TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed
project.tasks.withType(AbstractPublishToMaven::class.java).configureEach {
dependsOn(project.tasks.withType(Sign::class.java))
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ kotlinx-coroutines = "1.10.2"
kotlinx-serialization = "1.8.1"
kotlinx-io = "0.7.0"
turbine = "1.1.0"
vanniktech-maven-publish = "0.33.0"

[libraries]
agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
Expand All @@ -25,3 +26,4 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa
kotlinx-serialization-json-io = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-io", version.ref = "kotlinx-serialization" }
kotlinx-io = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinx-io" }
turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
vanniktech-maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "vanniktech-maven-publish" }
Loading