diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json new file mode 100644 index 0000000..466df71 --- /dev/null +++ b/.github/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} diff --git a/.github/release-please-config.json b/.github/release-please-config.json new file mode 100644 index 0000000..36bd437 --- /dev/null +++ b/.github/release-please-config.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "simple", + "tag-separator": "", + "include-v-in-tag": true, + "versioning": "semver", + "packages": { + ".": {} + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bb43fc..f2a0029 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,10 @@ jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - uses: actions/checkout@v4 with: @@ -25,3 +29,10 @@ jobs: - name: Build run: ./gradlew build + + - name: Publish + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(main): release') + run: ./gradlew publish + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..0402975 --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,22 @@ +name: PR Lint + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +jobs: + pr-title: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v6.1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + commit-messages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: wagoid/commitlint-github-action@v6.2.1 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..89ab96d --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,19 @@ +name: Release Please + +on: + push: + branches: [main] + +jobs: + release-please: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - uses: googleapis/release-please-action@v5 + with: + config-file: .github/release-please-config.json + manifest-file: .github/.release-please-manifest.json diff --git a/build.gradle.kts b/build.gradle.kts index 625824f..3b2d192 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,28 @@ plugins { + alias(libs.plugins.git.versioning) alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.ktlint) apply false alias(libs.plugins.kover) apply false } + +version = "0.0.0-SNAPSHOT" +group = "net.oxspring.markflow" + +gitVersioning.apply { + refs { + tag("v(?.+)") { + version = "\${ref.version}" + } + branch(".+") { + version = "\${ref}-SNAPSHOT" + } + } + rev { + version = "\${commit}-SNAPSHOT" + } +} + +subprojects { + version = rootProject.version + group = rootProject.group +} diff --git a/gradle-plugin/build.gradle.kts b/gradle-plugin/build.gradle.kts index 15ffefd..d0bbc5a 100644 --- a/gradle-plugin/build.gradle.kts +++ b/gradle-plugin/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("markflow.convention") `java-gradle-plugin` + `maven-publish` } dependencies { @@ -15,6 +16,21 @@ gradlePlugin { create("markflow") { id = "net.oxspring.markflow" implementationClass = "net.oxspring.markflow.gradle.MarkflowPlugin" + displayName = "Markflow" + description = "Gradle plugin for Markdown processing pipelines" + } + } +} + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/roxspring/markflow") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 09bf133..f41aedf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,21 +1,23 @@ [versions] -kotlin = "2.2.0" +assertj = "3.27.3" flexmark = "0.64.8" +git-versioning = "6.4.4" jacksonYaml = "2.19.0" junit5 = "6.1.3" -assertj = "3.27.3" -ktlint-gradle = "12.1.1" +kotlin = "2.2.0" kover = "0.9.9" +ktlint-gradle = "12.1.1" [libraries] +assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } flexmark-all = { module = "com.vladsch.flexmark:flexmark-all", version.ref = "flexmark" } jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jacksonYaml" } jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jacksonYaml" } junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit5" } -assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } [plugins] +git-versioning = { id = "me.qoomon.git-versioning", version.ref = "git-versioning" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-gradle" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-gradle" } diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 92d6fdf..cfacec5 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -1,5 +1,7 @@ plugins { id("markflow.convention") + `java-library` + `maven-publish` } dependencies { @@ -11,6 +13,47 @@ dependencies { testImplementation(libs.assertj.core) } +java { + withSourcesJar() + withJavadocJar() +} + +publishing { + publications { + create("library") { + from(components["java"]) + + pom { + name = "markflow" + description = "Kotlin/JVM library for Markdown processing pipelines" + url = "https://github.com/roxspring/markflow" + licenses { + license { + name = "Apache-2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0" + } + } + scm { + connection = "scm:git:git://github.com/roxspring/markflow.git" + developerConnection = "scm:git:ssh://github.com/roxspring/markflow.git" + url = "https://github.com/roxspring/markflow" + } + } + } + } + + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/roxspring/markflow") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} + kover { reports { total {