diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdcba10..7828292 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -159,8 +159,18 @@ jobs: SOURCE_DIR: "build/docs/javadoc" DEST_DIR: "boxlang-runtimes/${{ env.MODULE_ID }}/${{ env.VERSION }}" - # - name: Publish to Maven Central + # Publish to Maven Central + Github ONLY on Beta/Final Releases + # - name: Publish Package (Maven+Github) + # if: env.SNAPSHOT == 'false' # run: | + # gradle publish --no-daemon --no-parallel + # gradle publishToSonatype closeAndReleaseSonatypeStagingRepository + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # GPG_KEY: ${{ secrets.GPG_KEY }} + # GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + # MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + # MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - name: Publish to ForgeBox run: | diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 005c4a1..927756a 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -71,5 +71,6 @@ jobs: permissions: checks: write contents: write + packages: write with: snapshot: true diff --git a/build.gradle b/build.gradle index da7267d..4c61fc4 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,10 @@ plugins { id "de.undercouch.download" version "5.6.0" // Task visualizer id "com.dorongold.task-tree" version "4.0.0" + // Maven Publisher + id 'maven-publish' + id 'signing' + id 'com.gradleup.nmcp' version "0.0.9" } /** @@ -65,6 +69,7 @@ dependencies { java { withJavadocJar() + withSourcesJar() } compileJava { @@ -100,6 +105,145 @@ shadowJar { } build.dependsOn( shadowJar ); +/** + * Publish the artifacts to the local maven repository + */ +publishing { + publications { + shadow( MavenPublication ) { publication -> + artifact shadowJar + artifact javadocJar + artifact sourcesJar + + // This is the only one sonatype accepts, not ortus.boxlang + // https://central.sonatype.com/ + groupId = 'io.boxlang' + artifactId = 'boxlang-servlet' + pom { + name = "BoxLang Servlet Runtime" + description = "BoxLang is a dynamic multi-runtime JVM Language based on fluency and functional constructs. This is the Servlet Runtime for BoxLang." + url = "https://boxlang.io" + issueManagement { + system = "Jira" + url = "https://ortussolutions.atlassian.net/jira/software/c/projects/BL/issues" + } + mailingLists { + mailingList { + name = "BoxLang Community" + subscribe = "https://community.ortussolutions.com/c/boxlang/42" + unsubscribe = "https://community.ortussolutions.com/c/boxlang/42" + } + } + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + scm { + connection = 'scm:git:https://github.com/ortus-boxlang/boxlang.git' + developerConnection = 'scm:git:ssh://github.com/ortus-boxlang/boxlang.git' + url = 'https://github.com/ortus-boxlang/boxlang' + } + developers{ + developer { + id = "lmajano" + name = "Luis Majano" + email = "lmajano@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "bdw429s" + name = "Brad Wood" + email = "brad@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "jclausen" + name = "Jon Clausen" + email = "jclausen@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "michaelborn" + name = "Michael Born" + email = "michael@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "garciadev" + name = "Daniel Garcia" + email = "dgarcia@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "jbeers" + name = "Jacob Beers" + email = "jbeers@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "gpickin" + name = "Gavin Pickin" + email = "gavin@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + developer { + id = "ericpeterson" + name = "Eric Peterson" + email = "eric@ortussolutions.com" + organization = "Ortus Solutions, Corp" + organizationUrl = "https://www.ortussolutions.com" + } + } + } + } + } + + repositories { + maven { + name = 'local-repo' + url = layout.buildDirectory.dir( "repo" ) + } + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/ortus-boxlang/boxlang" + credentials { + username = System.getenv( "GITHUB_ACTOR" ) + password = System.getenv( "GITHUB_TOKEN" ) + } + } + } +} + +nmcp { + publishAllProjectsProbablyBreakingProjectIsolation { + username = System.getenv( "MAVEN_USERNAME" ) ?: project.findProperty( "maven_username" ) + password = System.getenv( "MAVEN_PASSWORD" ) ?: project.findProperty( "maven_password" ) + // publish manually from the portal + //publicationType = "USER_MANAGED" + // or if you want to publish automatically + publicationType = "AUTOMATIC" + } +} + +/** + * Digital Signing of assets + */ +signing { + def signingKey = System.getenv("GPG_KEY") ?: project.findProperty("signing.keyId") + def signingPassword = System.getenv("GPG_PASSWORD") ?: project.findProperty("signing.password") + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.shadow +} + /** * Docs are here: * - https://github.com/harbby/gradle-serviceloader, diff --git a/gradle.properties b/gradle.properties index ca8dd7d..484b1d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -#Fri Sep 13 11:29:06 UTC 2024 -boxlangVersion=1.0.0-beta15 +#Fri Sep 20 13:05:51 UTC 2024 +boxlangVersion=1.0.0-beta16 jdkVersion=21 -version=1.0.0-beta15 +version=1.0.0-beta16 group=ortus.boxlang diff --git a/src/main/java/ortus/boxlang/web/exchange/BoxHTTPServletExchange.java b/src/main/java/ortus/boxlang/web/exchange/BoxHTTPServletExchange.java index 8b62eac..a112037 100644 --- a/src/main/java/ortus/boxlang/web/exchange/BoxHTTPServletExchange.java +++ b/src/main/java/ortus/boxlang/web/exchange/BoxHTTPServletExchange.java @@ -172,6 +172,12 @@ public void addResponseHeader( String name, String value ) { @Override public void flushResponseBuffer() { try { + + var contentType = getResponseHeader( "Content-Type" ); + if ( contentType == null || contentType.isEmpty() ) { + setResponseHeader( "Content-Type", "text/html;charset=UTF-8" ); + } + response.flushBuffer(); } catch ( IOException e ) { throw new BoxRuntimeException( "Could not flush response buffer", e );