Skip to content

Commit

Permalink
Merge pull request #14 from teogor/feature/maven-deploy
Browse files Browse the repository at this point in the history
🚀 Enhancements: Sudoku Puzzle Generation Library
  • Loading branch information
teogor authored Aug 24, 2023
2 parents 9ecc797 + a5d0b8c commit 0027e06
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish

on:
release:
types: [ released ]
workflow_dispatch:

jobs:
publish:
name: Snapshot build and publish
runs-on: ubuntu-latest
environment: PRODUCTION
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 }}
steps:
- name: Check out code
uses: actions/[email protected]

- name: Set up JDK 11
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: 11

- name: Grant Permission to Execute Gradle
run: chmod +x gradlew

- name: Publish to MavenCentral
run: |
./gradlew publishAllPublicationsToMavenCentral
4 changes: 4 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,9 @@ gradlePlugin {
id = "sudoklify.kotlin.library"
implementationClass = "KotlinLibraryConventionPlugin"
}
register("mavenPublishLibrary") {
id = "sudoklify.maven.publish.library"
implementationClass = "MavenPublishLibraryConventionPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2023 Teogor (Teodor Grigor)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.gradle.api.Plugin
import org.gradle.api.Project

class MavenPublishLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.vanniktech.maven.publish")
}
}
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.21"
id("com.vanniktech.maven.publish") version "0.25.3" apply false
}

apply(from = "githooks.gradle.kts")
Expand Down
37 changes: 37 additions & 0 deletions sudoklify/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.vanniktech.maven.publish.SonatypeHost
import dev.teogor.sudoklify.buildlogic.BuildInfo

plugins {
id("sudoklify.kotlin.library")
id("sudoklify.maven.publish.library")
}

group = BuildInfo.group.fullName
Expand All @@ -29,3 +31,38 @@ tasks.test {
dependencies {
testImplementation("junit:junit:4.13.2")
}

@Suppress("UnstableApiUsage")
mavenPublishing {
publishToMavenCentral(SonatypeHost.S01)

signAllPublications()

coordinates("dev.teogor.sudoklify", "sudoklify", "1.0.0-alpha01")

pom {
name.set("Sudoklify")
description.set("Sudoklify stands as a versatile and user-friendly Sudoku puzzle generation library crafted in Kotlin. Effortlessly generate, manipulate, and solve Sudoku puzzles with ease.")
inceptionYear.set("2023")
url.set("https://github.com/teogor/sudoklify/") // Update this URL
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
distribution.set("repo")
}
}
developers {
developer {
id.set("teogor") // Update your GitHub username
name.set("Teodor Grigor") // Update your name
url.set("https://github.com/teogor/")
}
}
scm {
url.set("https://github.com/teogor/sudoklify/") // Update this URL
connection.set("scm:git:https://github.com/teogor/sudoklify.git") // Update this connection URL
developerConnection.set("scm:git:[email protected]:teogor/sudoklify.git") // Update this developer connection URL
}
}
}

0 comments on commit 0027e06

Please sign in to comment.