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
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: lts/*
node-version-file: .nvmrc
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Release Check
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
run: npx semantic-release
run: pnpm release

6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
env:
ORG_GRADLE_PROJECT_version: ${{ github.event.release.tag_name }}
ORG_GRADLE_PROJECT_githubRepository: ${{ github.repository }}
GRADLE_OPTS: -Dorg.gradle.configuration-cache=false

jobs:
release:
Expand All @@ -30,11 +29,12 @@ jobs:
- name: Release Artefacts
run: ./gradlew release
env:
GRADLE_OPTS: -Dorg.gradle.configuration-cache=false
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PACKAGE_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyPassword: ${{ secrets.PACKAGE_SIGNING_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

docs:
name: Publish Documentation
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ build/

### Kotlin
/.kotlin/

### Node.JS
/node_modules/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24.11.0
55 changes: 34 additions & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import io.github.gradlenexus.publishplugin.NexusRepository
import org.gradle.kotlin.dsl.*
import org.jreleaser.model.Active.ALWAYS


plugins {
kotlin("jvm") version "2.2.21"
id("org.jetbrains.dokka-javadoc") version "2.1.0"
id("org.jetbrains.dokka") version "2.1.0"
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("org.jreleaser") version "1.21.0"
}

group = "de.joshuagleitze"
Expand Down Expand Up @@ -52,8 +53,7 @@ tasks.withType<Test>().configureEach {
}
}

val ossrhUsername: String? by project
val ossrhPassword: String? by project

val githubRepository: String? by project
val githubOwner = githubRepository?.split("/")?.get(0)
val githubToken: String? by project
Expand Down Expand Up @@ -84,7 +84,7 @@ val dokkaJar by tasks.registering(Jar::class) {

lateinit var publication: MavenPublication
lateinit var githubPackages: ArtifactRepository
lateinit var mavenCentral: NexusRepository
lateinit var mavenCentralStaging: MavenArtifactRepository

publishing {
publications {
Expand Down Expand Up @@ -128,6 +128,9 @@ publishing {
}
}
repositories {
mavenCentralStaging = maven(layout.buildDirectory.dir("publish/maven-central-staging")) {
name = "MavenCentralStaging"
}
githubPackages = maven("https://maven.pkg.github.com/$githubRepository") {
name = "GitHubPackages"
credentials {
Expand All @@ -138,31 +141,41 @@ publishing {
}
}

nexusPublishing {
repositories {
mavenCentral = sonatype {
username = ossrhUsername
password = ossrhPassword
signing {
useInMemoryPgpKeys(
providers.gradleProperty("signingKey").orNull,
providers.gradleProperty("signingKeyPassword").orNull
)
sign(publication)
}

jreleaser {
deploy {
maven {
mavenCentral {
register("sonatype") {
url = "https://central.sonatype.com/api/v1/publisher"
active = ALWAYS
stagingRepository(mavenCentralStaging.url.toString())
}
}
}
}
}

signing {
val signingKey: String? by project
val signingKeyPassword: String? by project
useInMemoryPgpKeys(signingKey, signingKeyPassword)
sign(publication)
}
val jreleaserConfig by tasks
val jreleaserDeploy by tasks

val closeAndReleaseStagingRepositories by project.tasks
closeAndReleaseStagingRepositories.mustRunAfter(mavenCentral.publishTask)
jreleaserDeploy.mustRunAfter(jreleaserConfig)
jreleaserDeploy.mustRunAfter(mavenCentralStaging.publishTask)

val release by tasks.registering {
group = "release"
description = "Releases the project to Maven Central"
dependsOn(githubPackages.publishTask, mavenCentral.publishTask, closeAndReleaseStagingRepositories)
description = "Releases the project to all repositories"
dependsOn(jreleaserConfig, githubPackages.publishTask, mavenCentralStaging.publishTask, jreleaserDeploy)
}

fun String.drop(prefix: String) = if (this.startsWith(prefix)) this.drop(prefix.length) else this
val ArtifactRepository.publishTask get() = tasks["publishAllPublicationsTo${this.name}Repository"]
val NexusRepository.publishTask get() = "publishTo${this.name.replaceFirstChar { it.titlecase() }}"
fun ProviderFactory.requiredGradleProperty(name: String): Provider<String> = gradleProperty(name)
.orElse(provider { throw InvalidUserDataException("required project property `$name` was not set!")})
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.parallel=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache=false
org.gradle.configuration-cache.parallel=true

org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
Expand Down
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "string-notation",
"description": "",
"keywords": [],
"author": {
"name": "Joshua Gleitze",
"url": "https://joshuagleitze.de"
},
"license": "MIT",
"scripts": {
"release": "semantic-release"
},
"devDependencies": {
"semantic-release": "25.0.2"
},
"packageManager": "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd"
}
Loading