Added publish workflow for GitHub
This commit is contained in:
parent
dd61c799f3
commit
14080895c7
3 changed files with 117 additions and 3 deletions
37
.github/workflows/publish.yml
vendored
Normal file
37
.github/workflows/publish.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
name: Publish to the Maven Central
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-gradle-project:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- name: Publish with Gradle
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
env:
|
||||||
|
SONATYPE_USER: ${{ secrets.SONATYPE_USER}}
|
||||||
|
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_signingKey }}
|
||||||
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingPassword }}
|
||||||
|
with:
|
||||||
|
arguments: publish --stacktrace
|
|
@ -3,10 +3,15 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
pmd
|
pmd
|
||||||
|
signing
|
||||||
id("com.github.ben-manes.versions") version "0.46.0"
|
id("com.github.ben-manes.versions") version "0.46.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val rifeVersion by rootProject.extra { "1.5.0-SNAPSHOT" }
|
||||||
|
|
||||||
|
group = "com.uwyn.rife2"
|
||||||
version = "0.9.0-SNAPSHOT"
|
version = "0.9.0-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -16,10 +21,10 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.uwyn.rife2:rife2:1.5.0-SNAPSHOT") {
|
implementation("com.uwyn.rife2:rife2:${rifeVersion}") {
|
||||||
this.isChanging = true
|
this.isChanging = true
|
||||||
}
|
}
|
||||||
runtimeOnly("com.uwyn.rife2:rife2:1.5.0-SNAPSHOT:agent") {
|
runtimeOnly("com.uwyn.rife2:rife2:${rifeVersion}:agent") {
|
||||||
this.isChanging = true
|
this.isChanging = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +55,10 @@ pmd {
|
||||||
|
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
testLogging {
|
testLogging {
|
||||||
|
@ -57,4 +66,71 @@ tasks {
|
||||||
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
title = "<a href=\"https://rife2.com\">RIFE2</a> Template Renderers"
|
||||||
|
options {
|
||||||
|
this as StandardJavadocDocletOptions
|
||||||
|
keyWords(true)
|
||||||
|
splitIndex(true)
|
||||||
|
links()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("mavenJava") {
|
||||||
|
artifactId = "rife2-renderers"
|
||||||
|
from(components["java"])
|
||||||
|
pom {
|
||||||
|
name.set("RIFE2 Template Renderers")
|
||||||
|
description.set("Template Renderers for the RIFE2 framework")
|
||||||
|
url.set("https://github.com/rife2/rife2-template-renderers")
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name.set("The Apache License, Version 2.0")
|
||||||
|
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id.set("ethauvin")
|
||||||
|
name.set("Erik C. Thauvin")
|
||||||
|
email.set("erik@thauvin.net")
|
||||||
|
url.set("https://erik.thauvin.net/")
|
||||||
|
}
|
||||||
|
developer {
|
||||||
|
id.set("gbevin")
|
||||||
|
name.set("Geert Bevin")
|
||||||
|
email.set("gbevin@uwyn.com")
|
||||||
|
url.set("https://github.com/gbevin")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection.set("scm:git:https://github.com/rife2/rife2-template-renderers.git")
|
||||||
|
developerConnection.set("scm:git:git@github.com:rife2/rife2-template-renderers.git")
|
||||||
|
url.set("https://github.com/rife2/rife2-template-renderers")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("SONATYPE_USER")
|
||||||
|
password = System.getenv("SONATYPE_PASSWORD")
|
||||||
|
}
|
||||||
|
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
||||||
|
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
val signingKey: String? by project // ORG_GRADLE_PROJECT_signingKey
|
||||||
|
val signingPassword: String? by project // ORG_GRADLE_PROJECT_signingPassword
|
||||||
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||||
|
sign(publishing.publications["mavenJava"])
|
||||||
|
}
|
|
@ -174,9 +174,10 @@ public final class RenderUtils {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/a/6766497/8356718
|
|
||||||
var len = src.length();
|
var len = src.length();
|
||||||
var sb = new StringBuilder(len * 6);
|
var sb = new StringBuilder(len * 6);
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/6766497/8356718
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
var codePoint = src.codePointAt(i);
|
var codePoint = src.codePointAt(i);
|
||||||
// Skip over the second char in a surrogate pair
|
// Skip over the second char in a surrogate pair
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue