diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8804af2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: Publish + +on: + release: + types: [ released ] + workflow_dispatch: + +jobs: + publish: + name: Snapshot build and publish + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3.6.0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3.13.0 + with: + distribution: 'zulu' + java-version: 17 + + - name: Grant Permission to Execute Gradle + run: chmod +x gradlew + + - name: Release build + run: ./gradlew assemble --scan + + - name: Publish to MavenCentral + run: | + ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} \ No newline at end of file diff --git a/scripts/publish-module.gradle.kts b/scripts/publish-module.gradle.kts index 88d13dd..6c1d1a2 100644 --- a/scripts/publish-module.gradle.kts +++ b/scripts/publish-module.gradle.kts @@ -1,9 +1,11 @@ -apply(plugin = "com.vannikteh.maven.publish") +import com.taewooyo.buildsrc.Configuration + +apply(plugin = "com.vanniktech.maven.publish") rootProject.extra.apply { val snapshot = System.getenv("SNAPSHOT").toBoolean() val libVersion = if(snapshot) { - Configuration.snapshotVeresionName + Configuration.snapshotVersionName } else { Configuration.versionName } diff --git a/volcano-compose/build.gradle.kts b/volcano-compose/build.gradle.kts index aa0ecde..a40487b 100644 --- a/volcano-compose/build.gradle.kts +++ b/volcano-compose/build.gradle.kts @@ -7,6 +7,22 @@ plugins { alias(libs.plugins.nexus.plugin) } +apply(from = "${rootDir}/scripts/publish-module.gradle.kts") + +mavenPublishing { + val artifactId = "volcano-compose" + coordinates( + Configuration.artifactGroup, + artifactId, + rootProject.extra.get("libVersion").toString() + ) + + pom { + name.set(artifactId) + description.set("Heatmap charts created in an optimized way, fully customizable for Android. Support only Jetpack Compose.") + } +} + android { compileSdk = Configuration.compileSdk namespace = "com.taewooyo.volcano.compose" diff --git a/volcano/build.gradle.kts b/volcano/build.gradle.kts index 245cd05..46ac25c 100644 --- a/volcano/build.gradle.kts +++ b/volcano/build.gradle.kts @@ -1,3 +1,5 @@ +import com.taewooyo.buildsrc.Configuration + @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed plugins { id("java-library") @@ -5,6 +7,22 @@ plugins { alias(libs.plugins.nexus.plugin) } +apply(from = "${rootDir}/scripts/publish-module.gradle.kts") + +mavenPublishing { + val artifactId = "volcano" + coordinates( + Configuration.artifactGroup, + artifactId, + rootProject.extra.get("libVersion").toString() + ) + + pom { + name.set(artifactId) + description.set("Heatmap charts created in an optimized way, fully customizable for Android. Support only Jetpack Compose.") + } +} + java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17