From 0fd49ea590b3e11636aced2421431fdff433bd2b Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Sun, 22 Sep 2024 13:46:11 -0400 Subject: [PATCH 1/6] Publish Snapshots to Artifactory --- .github/workflows/gradle.yml | 47 ++++++++++++++++++++++++++++++++++++ build.gradle | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..2ef464e1 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,47 @@ +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 + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: '8' + - 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: 'adopt' + java-version: '8' + - 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 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 9903e471..7acc75aa 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ 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' From 8af50fa914fb6ac23b83e4dcdb4d559436d559dd Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Sun, 22 Sep 2024 13:49:09 -0400 Subject: [PATCH 2/6] Remove redundant gradle check --- .github/workflows/gradle-check.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/gradle-check.yml diff --git a/.github/workflows/gradle-check.yml b/.github/workflows/gradle-check.yml deleted file mode 100644 index de2f5c50..00000000 --- a/.github/workflows/gradle-check.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Run tests in project - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 8 - - uses: gradle/gradle-build-action@v2 - with: - arguments: check \ No newline at end of file From 25b47d83abaee2c2a89083dfa61bbd713619c535 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Sun, 22 Sep 2024 14:17:18 -0400 Subject: [PATCH 3/6] Try normal secret --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2ef464e1..7884cc50 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -41,7 +41,7 @@ jobs: id: publish uses: gradle/gradle-build-action@v3 env: - ARTIFACTORY_USERNAME: ${{ secrets.TEMP_ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.TEMP_ARTIFACTORY_PASSWORD }} + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} with: arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish \ No newline at end of file From d1a49e9dcc8beb4e11f5460390aeb20e7c0e0048 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Sun, 22 Sep 2024 15:00:22 -0400 Subject: [PATCH 4/6] Brute force attempt to publish --- .github/workflows/gradle.yml | 5 +- build.gradle | 127 +++-------------------------------- gradle.properties | 5 ++ 3 files changed, 17 insertions(+), 120 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 7884cc50..c992c160 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -15,6 +15,7 @@ jobs: 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 @@ -41,7 +42,7 @@ jobs: id: publish uses: gradle/gradle-build-action@v3 env: - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + ARTIFACTORY_USERNAME: ${{ secrets.TEMP_ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.TEMP_ARTIFACTORY_PASSWORD }} with: arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7acc75aa..cfdcd1b4 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ buildscript { 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 { @@ -19,15 +18,12 @@ 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.8 targetCompatibility = 1.8 repositories { - mavenLocal() mavenCentral() maven { url "https://repo.grails.org/grails/core" } } @@ -55,114 +51,19 @@ dependencies { } } -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 = 'soeren+gpc@glasius.dk' - } - } - 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 Scaffolding Plugin" + desc = "Fields integration for Grails" + developers = [robfletcher: 'Rob Fletcher', graemerocher: "Graeme Rocher", sdelamo: "Sergio del Amo", sbglasius: 'Søren Berg Glasius'] } asciidoctor { @@ -189,13 +90,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") - } - } - } -} diff --git a/gradle.properties b/gradle.properties index fe33f5d9..04320f23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,3 +12,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 From c1351aa7881e6bb6686ac42be6a7218143c7084a Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Sun, 22 Sep 2024 15:04:46 -0400 Subject: [PATCH 5/6] correct title --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cfdcd1b4..dcad513d 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ grailsPublish { license { name = 'Apache-2.0' } - title = "Grails Scaffolding Plugin" + 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'] } From 59f17589dd5c8b2559074831a1fa8d22bff66d30 Mon Sep 17 00:00:00 2001 From: Scott Murphy Heiberg Date: Sun, 22 Sep 2024 16:17:02 -0400 Subject: [PATCH 6/6] Cleanup --- build.gradle | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 8757708c..6a460ca6 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,9 @@ 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' } } plugins { @@ -20,13 +18,11 @@ apply plugin: 'org.grails.grails-gsp' apply plugin: "org.grails.grails-doc" 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 {