Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/deploy-docs.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/publish-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Publish Package to Maven Registry

on:
push:
tags:
- 'v*'

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create a release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true

generate-docs:
needs: create-release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Generate docs
run: ./gradlew :dokkaHtml

- name: Bundle Docs
uses: actions/upload-pages-artifact@v3
with:
path: "./docs"

publish-package:
needs: create-release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Publish package
run: ./gradlew :publish
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

deploy-docs:
needs: [generate-docs, publish-package]

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy docs
id: deployment
uses: actions/deploy-pages@v3
75 changes: 58 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URI

plugins {
kotlin("jvm") version "2.0.0"
alias(libs.plugins.dokka)
`java-library`
kotlin("jvm") version "2.0.0"
alias(libs.plugins.dokka)
alias(libs.plugins.maven.publishing)
`java-library`
}

group = "io.github.cybercodernaj"
Expand All @@ -13,33 +17,70 @@ version = libs.versions.lib.get()
val docsDir = layout.projectDirectory.dir("docs/")

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
testImplementation(kotlin("test"))
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
useJUnitPlatform()
}
kotlin {
jvmToolchain(18)
jvmToolchain(18)
}

tasks.withType<DokkaTask>().configureEach {
moduleName.set(project.name)
moduleVersion.set(project.version.toString())
outputDirectory.set(docsDir)
dokkaSourceSets.configureEach {
sourceLink {
localDirectory.set(projectDir.resolve("src"))
remoteUrl.set(URI.create("https://github.com/cybercoder-naj/Parkour/blob/main/src").toURL())
remoteLineSuffix.set("#L")
}
moduleName.set(project.name)
moduleVersion.set(project.version.toString())
outputDirectory.set(docsDir)
dokkaSourceSets.configureEach {
sourceLink {
localDirectory.set(projectDir.resolve("src"))
remoteUrl.set(URI.create("https://github.com/cybercoder-naj/Parkour/blob/main/src").toURL())
remoteLineSuffix.set("#L")
}
}
}

tasks.clean {
delete = setOf(docsDir, layout.buildDirectory)
delete = setOf(docsDir, layout.buildDirectory)
}

mavenPublishing {
configure(KotlinJvm(
javadocJar = JavadocJar.Dokka("dokkaHtml"),
sourcesJar = true
))

publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)

coordinates(project.group.toString(), project.name, project.version.toString())

pom {
name.set("Parkour")
description.set("Parser Combinator library for Kotlin")
inceptionYear.set("2024")
url.set("https://github.com/cybercoder-naj/Parkour/")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/cybercoder-naj/Parkour/blob/main/LICENSE")
distribution.set("repo")
}
}
developers {
developer {
id.set("cybercoder-naj")
name.set("Nishant Aanjaney Jalan")
url.set("https://github.com/cybercoder-naj/")
}
}
scm {
url.set("https://github.com/cybercoder-naj/Parkour/")
connection.set("scm:git:git://github.com/cybercoder-naj/Parkour.git")
developerConnection.set("scm:git:ssh://git@github.com/cybercoder-naj/Parkour.git")
}
}
}
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[versions]
lib = "0.0.1"
dokkaVer = "1.9.20"
mavenPublishingVer = "0.28.0"

[plugins]
dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaVer" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaVer" }
maven-publishing = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublishingVer" }