Skip to content

Commit 3f2d3cb

Browse files
Setup Github Actions (#1)
* test github actions * move loading publishing properties to signing block * setup properties file * deployment added with other fixes to publication * Empty-Commit * build fix with publish to maven local * add signing keys secrets * try new env variable for signing keys * add deployment to gradle plugin portal * add deploy plugin portal * readme updated --------- Co-authored-by: kartik.prakash <[email protected]>
1 parent 08489cd commit 3f2d3cb

33 files changed

+388
-236
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- "**/*.md"
9+
pull_request:
10+
paths-ignore:
11+
- "**/*.md"
12+
13+
workflow_dispatch:
14+
15+
env:
16+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
17+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
18+
19+
jobs:
20+
build:
21+
runs-on: macos-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: JDK setup
27+
uses: actions/setup-java@v4
28+
with:
29+
java-version: 17
30+
distribution: corretto
31+
32+
- name: Cache konan directory
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.konan
36+
key: ${{ runner.os }}-konan-${{ hashFiles('*.gradle.kts', 'buildSrc/*') }}
37+
restore-keys: |
38+
${{ runner.os }}-konan-
39+
40+
- name: iOS build
41+
run: |
42+
./gradlew publishKotlinMultiplatformPublicationToMavenLocal --no-daemon --stacktrace
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
8+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
9+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
10+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
11+
12+
jobs:
13+
deploy:
14+
runs-on: macos-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: JDK setup
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: 17
23+
distribution: corretto
24+
25+
- name: Mac deploy
26+
run: ./gradlew publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET --no-daemon --stacktrace

.github/workflows/deploy.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
8+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
9+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
10+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
11+
12+
jobs:
13+
deploy:
14+
runs-on: macos-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: JDK setup
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: 17
23+
distribution: corretto
24+
25+
- name: Mac deploy
26+
run: ./gradlew publish --no-daemon --stacktrace

.github/workflows/github-actions-demo.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Add the following gradle plugin in your `build.gradle.kts` of `shared`/common gr
3131

3232
```
3333
plugins {
34-
id ("com.kartikprakash2.kmp.workmanager") version "<version>"
34+
id ("io.github.kprakash2.kmp-workmanager-gradle") version "<version>"
3535
}
3636
```
3737

@@ -67,7 +67,7 @@ kotlin {
6767
sourceSets {
6868
val commonMain by getting {
6969
dependencies {
70-
implementation("com.kartikprakash2.multiplatform.tools:multiplatform-work-manager:<version>")
70+
implementation("io.github.kprakash2:kmp-workmanager:<version>")
7171
}
7272
}
7373
}
@@ -170,7 +170,7 @@ BackgroundJobConfiguration(
170170
- [ ] Setup Github Actions
171171
- [ ] Add publishing and publish 1st version
172172
- [ ] Add test for `shared` module
173-
- [ ] Add test for `kmp-work-managerplugin`
173+
- [ ] Add test for `kmp-workmanager` plugin
174174
- [ ] Add support for high frequency periodic jobs (recurring at frequency of less than 15 mins.)
175175
- [ ] Add support for backoff strategies
176176
- [ ] Add support for Network constraints
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2025 Kartik Prakash
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
`kotlin-dsl`
19+
}
20+
21+
dependencies {
22+
fun plugin(id: String, version: String) = "$id:$id.gradle.plugin:$version"
23+
24+
implementation(libs.kotlin.gradle)
25+
implementation(libs.kotlin.compiler.embeddable)
26+
implementation(libs.android.gradle)
27+
28+
implementation(plugin(libs.plugins.maven.publish.get().toString(), libs.versions.maven.publish.get()))
29+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
gradlePluginPortal()
5+
mavenCentral()
6+
}
7+
}
8+
9+
dependencyResolutionManagement {
10+
repositories {
11+
google()
12+
mavenCentral()
13+
}
14+
versionCatalogs {
15+
create("libs") {
16+
from(files("../gradle/libs.versions.toml"))
17+
}
18+
}
19+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
4+
/*
5+
* Copyright 2025 Kartik Prakash
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
plugins {
21+
kotlin("multiplatform")
22+
id("com.android.library")
23+
}
24+
25+
kotlin {
26+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
27+
compilerOptions {
28+
freeCompilerArgs.add("-Xexpect-actual-classes")
29+
}
30+
androidTarget {
31+
publishAllLibraryVariants()
32+
compilations.all {
33+
compileTaskProvider.configure {
34+
compilerOptions {
35+
jvmTarget.set(JvmTarget.JVM_17)
36+
}
37+
}
38+
}
39+
}
40+
iosX64()
41+
iosArm64()
42+
iosSimulatorArm64()
43+
}
44+
45+
android {
46+
namespace = "io.github.kprakash2"
47+
compileSdk = 35
48+
defaultConfig {
49+
minSdk = 24
50+
}
51+
compileOptions {
52+
sourceCompatibility = JavaVersion.VERSION_17
53+
targetCompatibility = JavaVersion.VERSION_17
54+
}
55+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import com.vanniktech.maven.publish.SonatypeHost
2+
3+
/*
4+
* Copyright 2025 Kartik Prakash
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
plugins {
20+
id("com.vanniktech.maven.publish")
21+
id("signing")
22+
}
23+
24+
mavenPublishing {
25+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
26+
signAllPublications()
27+
28+
pom {
29+
name = "Multiplatform Work Manager"
30+
description = "Multiplatform Work Manager."
31+
inceptionYear = "2025"
32+
url = "https://github.com/kprakash2/multiplatform-work-manager/"
33+
licenses {
34+
license {
35+
name = "The Apache License, Version 2.0"
36+
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
37+
distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
38+
}
39+
}
40+
developers {
41+
developer {
42+
id = "kprakash2"
43+
name = "Kartik Prakash"
44+
url = "https://github.com/kprakash2/"
45+
}
46+
}
47+
scm {
48+
url = "https://github.com/kprakash2/multiplatform-work-manager/"
49+
}
50+
}
51+
}
52+
53+
signing {
54+
val signingKey = findProperty("signing.key")?.toString()?.replace("\\n", "\n")
55+
56+
if (signingKey != null) {
57+
val signingKeyPassword = findProperty("signing.password")?.toString()
58+
59+
useInMemoryPgpKeys(
60+
signingKey,
61+
signingKeyPassword
62+
)
63+
sign(publishing.publications)
64+
}
65+
}

build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@
1717
plugins {
1818
alias(libs.plugins.androidLibrary).apply(false)
1919
alias(libs.plugins.kotlinMultiplatform).apply(false)
20-
alias(libs.plugins.maven.publish).apply(false)
2120
alias(libs.plugins.dokka).apply(false)
21+
alias(libs.plugins.gradle.publish).apply(false)
2222
alias(libs.plugins.nebula.release)
2323
alias(libs.plugins.ktlint)
2424
}
25+
26+
allprojects {
27+
group = "io.github.kprakash2"
28+
version = rootProject.version.toString()
29+
}

0 commit comments

Comments
 (0)