Skip to content

Commit bec5d21

Browse files
authored
Publish to Maven Central (#10)
1 parent 78f86a6 commit bec5d21

File tree

11 files changed

+140
-53
lines changed

11 files changed

+140
-53
lines changed

.github/ci-gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
org.gradle.daemon=false
2+
org.gradle.parallel=true
3+
org.gradle.jvmargs=-Xmx4608m -XX:MaxMetaspaceSize=1536m -XX:+HeapDumpOnOutOfMemoryError
4+
kotlin.compiler.execution.strategy=in-process

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish
2+
on:
3+
workflow_dispatch:
4+
release:
5+
types: [ prereleased, released ]
6+
7+
jobs:
8+
release:
9+
name: Publish library
10+
runs-on: macos-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
ref: ${{ github.event.release.tag_name }}
16+
17+
- name: Copy CI gradle.properties
18+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
19+
20+
- name: setup-java
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: 17
24+
distribution: adopt
25+
26+
- name: Deploy to Sonatype
27+
run: |
28+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
29+
echo "New version: ${NEW_VERSION}"
30+
export ORG_GRADLE_PROJECT_VERSION_NAME=${NEW_VERSION}
31+
./gradlew publish --stacktrace
32+
env:
33+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
34+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
35+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
36+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

README.md

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,7 @@ library.
4343

4444
## Setup
4545

46-
First you need to add jitpack to either your root level `build.gradle.kts` or
47-
your `settings.gradle.kts` file:
48-
49-
In `build.gradle.kts`:
50-
51-
```kotlin
52-
allprojects {
53-
repositories {
54-
maven { url = uri("https://jitpack.io") }
55-
}
56-
}
57-
```
58-
59-
Or `settings.gradle.kts`:
60-
61-
```kotlin
62-
dependencyResolutionManagement {
63-
repositories {
64-
maven { url = uri("https://jitpack.io") }
65-
}
66-
}
67-
```
46+
You can add this library to your project using Gradle.
6847

6948
### Single Platform
7049

@@ -74,18 +53,18 @@ file:
7453
```kotlin
7554
dependencies {
7655
// Includes the core functionality along with all of the optional modules
77-
implementation("com.dragselectcompose.drag-select-compose:full:2.0.0")
56+
implementation("com.dragselectcompose:dragselect:2.0.0")
7857

7958
// Or use the modules you want
8059

8160
// Core functionality
82-
implementation("com.dragselectcompose.drag-select-compose:core:2.0.0")
61+
implementation("com.dragselectcompose:core:2.0.0")
8362

8463
// Optional extensions for adding semantics and toggle Modifiers to Grid items
85-
implementation("com.dragselectcompose.drag-select-compose:extensions:2.0.0")
64+
implementation("com.dragselectcompose:extensions:2.0.0")
8665

8766
// Optional wrappers around LazyGrid that implement the selection UI for you
88-
implementation("com.dragselectcompose.drag-select-compose:grid:2.0.0")
67+
implementation("com.dragselectcompose:grid:2.0.0")
8968
}
9069
```
9170

@@ -99,18 +78,18 @@ kotlin {
9978
commonMain {
10079
dependencies {
10180
// Includes the core functionality along with all of the optional modules
102-
implementation("com.dragselectcompose.drag-select-compose:full:2.0.0")
81+
implementation("com.dragselectcompose:dragselect:2.0.0")
10382

10483
// Or use the modules you want
10584

10685
// Core functionality
107-
implementation("com.dragselectcompose.drag-select-compose:core:2.0.0")
86+
implementation("com.dragselectcompose:core:2.0.0")
10887

10988
// Optional extensions for adding semantics and toggle Modifiers to Grid items
110-
implementation("com.dragselectcompose.drag-select-compose:extensions:2.0.0")
89+
implementation("com.dragselectcompose:extensions:2.0.0")
11190

11291
// Optional wrappers around LazyGrid that implement the selection UI for you
113-
implementation("com.dragselectcompose.drag-select-compose:grid:2.0.0")
92+
implementation("com.dragselectcompose:grid:2.0.0")
11493
}
11594
}
11695
}

build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@file:Suppress("UnstableApiUsage")
2+
3+
import com.vanniktech.maven.publish.SonatypeHost
14
import org.jetbrains.dokka.gradle.AbstractDokkaTask
25
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
36

@@ -9,6 +12,7 @@ plugins {
912
alias(libs.plugins.dokka)
1013
alias(libs.plugins.dependencies)
1114
alias(libs.plugins.binaryCompatibility)
15+
alias(libs.plugins.publish)
1216

1317
val kotlinVersion = libs.versions.kotlin.get()
1418
kotlin("multiplatform") version kotlinVersion apply false
@@ -28,6 +32,11 @@ apiValidation {
2832
}
2933
}
3034

35+
mavenPublishing {
36+
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)
37+
signAllPublications()
38+
}
39+
3140
tasks.withType<DokkaMultiModuleTask>().configureEach {
3241
outputDirectory.set(rootDir.resolve("dokka"))
3342
}

cleanup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ rm -rf iosApp/iosApp.xcworkspace
88
rm -rf iosApp/Pods
99
rm -rf iosApp/iosApp.xcodeproj/project.xcworkspace
1010
rm -rf iosApp/iosApp.xcodeproj/xcuserdata
11-
11+
rm -rf dokka

core/build.gradle.kts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@ plugins {
66
alias(libs.plugins.androidLibrary)
77
alias(libs.plugins.compose)
88
alias(libs.plugins.dokka)
9+
alias(libs.plugins.publish)
910
kotlin("multiplatform")
10-
id("maven-publish")
1111
}
1212

1313
kotlin {
1414
explicitApi = ExplicitApiMode.Strict
1515

16-
android()
16+
android {
17+
publishLibraryVariants("debug", "release")
18+
}
1719
jvm("desktop")
18-
iosX64()
19-
iosArm64()
20-
iosSimulatorArm64()
20+
21+
listOf(
22+
iosX64(),
23+
iosArm64(),
24+
iosSimulatorArm64()
25+
).forEach { framework ->
26+
framework.binaries.framework {
27+
baseName = "core"
28+
}
29+
}
2130

2231
sourceSets {
2332
val commonMain by getting {

dragselectcompose/build.gradle.kts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,27 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
55
plugins {
66
alias(libs.plugins.androidLibrary)
77
alias(libs.plugins.compose)
8+
alias(libs.plugins.publish)
89
kotlin("multiplatform")
9-
id("maven-publish")
1010
}
1111

1212
kotlin {
1313
explicitApi = ExplicitApiMode.Strict
1414

15-
android()
15+
android {
16+
publishLibraryVariants("debug", "release")
17+
}
1618
jvm("desktop")
17-
iosX64()
18-
iosArm64()
19-
iosSimulatorArm64()
19+
20+
listOf(
21+
iosX64(),
22+
iosArm64(),
23+
iosSimulatorArm64()
24+
).forEach { framework ->
25+
framework.binaries.framework {
26+
baseName = "full"
27+
}
28+
}
2029

2130
sourceSets {
2231
val commonMain by getting {
@@ -82,7 +91,7 @@ publishing {
8291
publications {
8392
register<MavenPublication>("release") {
8493
groupId = "com.dragselectcompose"
85-
artifactId = "full"
94+
artifactId = "dragselect"
8695
}
8796
}
8897
}

extensions/build.gradle.kts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@ plugins {
66
alias(libs.plugins.androidLibrary)
77
alias(libs.plugins.compose)
88
alias(libs.plugins.dokka)
9+
alias(libs.plugins.publish)
910
kotlin("multiplatform")
10-
id("maven-publish")
1111
}
1212

1313
kotlin {
1414
explicitApi = ExplicitApiMode.Strict
1515

16-
android()
16+
android {
17+
publishLibraryVariants("debug", "release")
18+
}
1719
jvm("desktop")
18-
iosX64()
19-
iosArm64()
20-
iosSimulatorArm64()
20+
21+
listOf(
22+
iosX64(),
23+
iosArm64(),
24+
iosSimulatorArm64()
25+
).forEach { framework ->
26+
framework.binaries.framework {
27+
baseName = "extensions"
28+
}
29+
}
2130

2231
sourceSets {
2332
val commonMain by getting {

gradle.properties

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,24 @@ kotlin.mpp.androidSourceSetLayoutVersion=2
1515

1616
# Compose
1717
org.jetbrains.compose.experimental.uikit.enabled=true
18-
kotlin.native.cacheKind=none
18+
kotlin.native.cacheKind=none
19+
20+
# Maven
21+
GROUP=com.dragselectcompose
22+
VERSION_NAME=2.0.0-SNAPSHOT
23+
24+
POM_DESCRIPTION=A Compose multiplatform library for adding Google Photos style drag-to-select multi-selection to a LazyGrid.
25+
POM_URL=https://github.com/jordond/drag-select-compose
26+
27+
POM_LICENCE_NAME=The MIT License
28+
POM_LICENCE_URL=https://github.com/jordond/drag-select-compose/blob/master/LICENSE
29+
POM_LICENCE_DIST=repo
30+
31+
POM_SCM_URL=https://github.com/jordond/drag-select-compose
32+
POM_SCM_CONNECTION=scm:git:https://github.com/jordond/drag-select-compose.git
33+
POM_SCM_DEV_CONNECTION=scm:git:[email protected]:jordond/drag-select-compose.git
34+
35+
POM_DEVELOPER_ID=jordond
36+
POM_DEVELOPER_NAME=Jordon de Hoog
37+
POM_DEVELOPER_URL=https://github.com/jordond
38+
POM_DEVELOPER_EMAIL=[email protected]

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ coil = "2.4.0"
2020
kamel = "0.5.1"
2121
ktor = "2.3.1"
2222
binaryCompatibility = "0.13.2"
23+
publish = "0.22.0"
2324

2425
[libraries]
2526
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
@@ -53,5 +54,6 @@ dependencies = { id = "com.github.ben-manes.versions", version.ref = "versions"
5354
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
5455
androidLibrary = { id = "com.android.library", version.ref = "agp" }
5556
binaryCompatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatibility" }
57+
publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }
5658

5759
[bundles]

0 commit comments

Comments
 (0)