Skip to content

Commit

Permalink
Merge pull request #362 from codeconsole/6.0.x-artifactory-1
Browse files Browse the repository at this point in the history
Snapshot publishing
  • Loading branch information
codeconsole authored Sep 22, 2024
2 parents 99dfa69 + 59f1758 commit 6a5bfc0
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 146 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/gradle-check.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Java CI
on:
push:
branches:
- 'master'
- '[5-9]+.[0-9]+.x'
pull_request:
branches:
- 'master'
- '[5-9]+.[0-9]+.x'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
WORKSPACE: ${{ github.workspace }}
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
SIGNING_KEYRING: ${{ secrets.SECRING_FILE }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run Build
uses: gradle/gradle-build-action@v3
with:
arguments: build -Dgeb.env=chromeHeadless
publish:
if: github.event_name == 'push'
needs: ['build']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Publish Artifacts (repo.grails.org)
id: publish
uses: gradle/gradle-build-action@v3
env:
ARTIFACTORY_USERNAME: ${{ secrets.TEMP_ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.TEMP_ARTIFACTORY_PASSWORD }}
with:
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
134 changes: 11 additions & 123 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,27 @@ buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.grails.org/grails/core" }
mavenLocal()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath 'io.github.groovylang.groovydoc:groovydoc-gradle-plugin:1.0.1'
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
}
}
plugins {
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}

group 'io.github.gpc'
group 'org.grails.plugins'

apply plugin: 'org.grails.grails-plugin'
apply plugin: 'org.grails.grails-gsp'
apply plugin: "org.grails.grails-doc"
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "io.github.gradle-nexus.publish-plugin"
apply plugin: "org.grails.internal.grails-plugin-publish"

sourceCompatibility = 1.17
targetCompatibility = 1.17
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
mavenLocal()
}

dependencies {
Expand All @@ -54,114 +47,19 @@ dependencies {
testRuntimeOnly "net.bytebuddy:byte-buddy:$byteBuddyVersion"
}

tasks.withType(GroovyCompile).configureEach {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx1024m']
}
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
}

publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = 'fields'
version = project.version

from components.java
artifact sourcesJar
artifact javadocJar

pom {
name = 'Fields'
description = 'Fields integration for Grails'
url = 'https://github.com/gpc/fields'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'robfletcher'
name = 'Rob Fletcher'
}
developer {
id = 'graemerocher'
name = 'Graeme Rocher'
}
developer {
id = 'sdelamo'
name = 'Sergio del Amo'
}
developer {
id = 'sbglasius'
name = 'Søren Berg Glasius'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/gpc/fields.git'
developerConnection = 'scm:git:https://github.com/gpc/fields.git'
url = 'https://github.com/gpc/fields'
}
}
}
}
}

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

if(System.getenv('SIGNING_KEY_ID')) {
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSPHRASE')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_FILE')
}

afterEvaluate {
signing {
if (System.getenv('SIGN_ARMORED_KEY')) {
String signingKey = System.getenv('SIGN_ARMORED_KEY')
String signingPassword = System.getenv('SIGN_PASSWORD')
useInMemoryPgpKeys(signingKey, signingPassword)
}
required {
isReleaseVersion
}

sign publishing.publications.maven
grailsPublish {
userOrg = "grails"
githubSlug = 'gpc/fields'
license {
name = 'Apache-2.0'
}
}

tasks.withType(Sign).configureEach {
onlyIf { isReleaseVersion }
}

import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository

tasks.withType(InitializeNexusStagingRepository).configureEach {
onlyIf { isReleaseVersion }
shouldRunAfter(tasks.withType(Sign))
}

nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileIdExternalConfig") ? project.sonatypeOssStagingProfileIdExternalConfig : ''

nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
title = "Grails Fields Plugin"
desc = "Fields integration for Grails"
developers = [robfletcher: 'Rob Fletcher', graemerocher: "Graeme Rocher", sdelamo: "Sergio del Amo", sbglasius: 'Søren Berg Glasius']
}

asciidoctor {
Expand All @@ -188,13 +86,3 @@ tasks.register('apiDocs', Copy) {
}

asciidoctor.dependsOn(apiDocs)

tasks.register('snapshotVersion') {
doLast {
if (isReleaseVersion) {
ant.propertyfile(file: "gradle.properties") {
entry(key: "version", value: "${project.version}-SNAPSHOT")
}
}
}
}
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ projectDesc=Customizable form-field rendering based on overrideable GSP template
guide=../../guide
projectUrl=https\://github.com/gpc/fields
developers=Robert Fletcher, Graeme Rocher, S\u00c3\u00b8ren Berg Glasius and more

org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1536M -XX:MaxMetaspaceSize=512M

0 comments on commit 6a5bfc0

Please sign in to comment.