Skip to content

Commit

Permalink
Set up Maven Publishing (#2)
Browse files Browse the repository at this point in the history
* Set up maven publishing

* Change to Java 17 and set up stub test
  • Loading branch information
mofeejegi authored Oct 26, 2024
1 parent cb65b5e commit 497d109
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 21 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Java CI with Gradle

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:

permissions:
contents: read

jobs:
build:
strategy:
matrix:
include:
- target: iosSimulatorArm64Test
os: macos-latest
- target: jvmTest
os: ubuntu-latest
- target: testDebugUnitTest
os: ubuntu-latest
- target: testReleaseUnitTest
os: ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v3
with:
path: |
~/.konan
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@ce999babab2de1c4b649dc15f0ee67e6246c994f
with:
arguments: ${{ matrix.target }}
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
on:
release:
types: [released, prereleased]
jobs:
publish:
name: Release build and publish
runs-on: macOS-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Publish to MavenCentral
run: ./gradlew publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}

31 changes: 16 additions & 15 deletions alert-banner/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ plugins {
alias(libs.plugins.vanniktech.mavenPublish)
}

//version = "0.1.0"

kotlin {
jvm()
androidTarget {
Expand Down Expand Up @@ -80,36 +78,39 @@ android {

}

group = "com.mofeejegi.alert"
version = "0.1.0-alpha01"

mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

signAllPublications()

coordinates(group.toString(), "library", version.toString())
coordinates(group.toString(), "alert-banner-compose", version.toString())

pom {
name = "My library"
description = "A library."
name = "Compose Alert Banner"
description = "A Compose Multiplatform library used to display basic alert types."
inceptionYear = "2024"
url = "https://github.com/kotlin/multiplatform-library-template/"
url = "https://github.com/mofeejegi/compose-alert-banner"
licenses {
license {
name = "XXX"
url = "YYY"
distribution = "ZZZ"
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "XXX"
name = "YYY"
url = "ZZZ"
id = "mofeejegi"
name = "Mofe Ejegi"
url = "https://mofeejegi.com"
}
}
scm {
url = "XXX"
connection = "YYY"
developerConnection = "ZZZ"
url = "https://github.com/mofeejegi/compose-alert-banner"
connection = "scm:git:git://github.com/mofeejegi/compose-alert-banner.git"
developerConnection = "scm:git:ssh://[email protected]/mofeejegi/compose-alert-banner.git"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package com.mofeejegi.alert.ui.bannertype

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import com.mofeejegi.alert.alert_banner.generated.resources.Res
import com.mofeejegi.alert.alert_banner.generated.resources.ic_check_circle
import com.mofeejegi.alert.alert_banner.generated.resources.ic_error
import com.mofeejegi.alert.ui.theme.AlertTheme
import compose_alert_banner.alert_banner.generated.resources.Res
import compose_alert_banner.alert_banner.generated.resources.ic_check_circle
import compose_alert_banner.alert_banner.generated.resources.ic_error
import org.jetbrains.compose.resources.DrawableResource

sealed class AlertBannerType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.mofeejegi.alert.alert_banner.generated.resources.Res
import com.mofeejegi.alert.alert_banner.generated.resources.ic_close
import com.mofeejegi.alert.ui.state.AlertAnimatedIn
import com.mofeejegi.alert.ui.state.AlertAnimatedOut
import com.mofeejegi.alert.ui.state.AlertBannerState
import com.mofeejegi.alert.ui.bannertype.AlertBannerType
import com.mofeejegi.alert.ui.state.AlertBannerViewEvent
import com.mofeejegi.alert.ui.state.AlertBannerViewModel
import com.mofeejegi.alert.ui.state.AlertDismissed
import compose_alert_banner.alert_banner.generated.resources.Res
import compose_alert_banner.alert_banner.generated.resources.ic_close
import kotlinx.coroutines.delay
import org.jetbrains.compose.resources.painterResource

Expand Down
10 changes: 10 additions & 0 deletions alert-banner/src/commonTest/kotlin/AlertBannerTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import kotlin.test.Test
import kotlin.test.assertEquals

class AlertBannerTest {

@Test
fun testRun() {
assertEquals(2, 1 + 1)
}
}
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ android-compileSdk = "34"
compose-plugin = "1.7.0"
kotlinx-datetime = "0.6.0"
lifecycle-viewmodel = "2.8.2"
vanniktech-maven = "0.30.0"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" }
Expand All @@ -25,4 +26,4 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.29.0" }
vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-maven" }

0 comments on commit 497d109

Please sign in to comment.