diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e41b7841..b623b9e2 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,4 +1,4 @@ -name: Java CI +name: "Java CI" on: push: branches: @@ -6,74 +6,62 @@ on: pull_request: branches: - '[4-9]+.[0-9]+.x' + workflow_dispatch: env: GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} - jobs: - test_project: - name: Test Project + name: "Test Project" if: github.event_name == 'pull_request' - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: fail-fast: true matrix: java: [11, 17] - steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - uses: actions/setup-java@v4 + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 with: - distribution: temurin java-version: ${{ matrix.java }} - - uses: gradle/actions/setup-gradle@v3 - - name: Run tests - env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "🏃 Run tests" run: ./gradlew check - publish_snapshot: - name: Build Project and Publish Snapshot release - runs-on: ubuntu-latest - if: github.event_name == 'push' - + if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository_owner == 'grails-plugins' + name: "Build Project and Publish Snapshot release" + needs: test_project + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - uses: actions/setup-java@v4 - with: { java-version: 11, distribution: temurin } - - uses: gradle/actions/setup-gradle@v3 - - - name: Build Project - env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - run: ./gradlew build - - - name: Publish Snapshot version to Artifactory (repo.grails.org) - if: success() - env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - ORG_GRADLE_PROJECT_artifactoryPublishUsername: ${{ secrets.ARTIFACTORY_USERNAME }} - ORG_GRADLE_PROJECT_artifactoryPublishPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} - run: > - ./gradlew - -Dorg.gradle.internal.publish.checksums.insecure=true - publish - - - name: Generate Snapshot Documentation - if: success() + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "📤 Publish Snapshot version to Artifactory (repo.grails.org)" env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + GRAILS_PUBLISH_RELEASE: 'false' + MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} + MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} + MAVEN_PUBLISH_URL: 'https://repo.grails.org/artifactory/plugins3-snapshots-local' + run: ./gradlew publish + - name: "📖 Generate Snapshot Documentation" run: ./gradlew docs - - - name: Publish Snapshot Documentation to Github Pages - if: success() - uses: micronaut-projects/github-pages-deploy-action@grails + - name: "📤 Publish Snapshot Documentation to Github Pages" + uses: apache/grails-github-actions/deploy-github-pages@asf env: - BRANCH: gh-pages - COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} - COMMIT_NAME: ${{ env.GIT_USER_NAME }} - FOLDER: build/docs/manual - GH_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GRADLE_PUBLISH_RELEASE: 'false' + SOURCE_FOLDER: build/docs \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1741674..fce0a336 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,41 +1,46 @@ -name: Release +name: "Release" on: release: types: [published] env: GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} - jobs: release: - runs-on: ubuntu-latest - + runs-on: ubuntu-24.04 + permissions: + packages: read # for pre-release workflow + contents: write # to commit changes related to the release and publish documentation to gh-pages + issues: write # to modify milestones steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - uses: actions/setup-java@v4 - with: { java-version: 11, distribution: temurin } - - uses: gradle/actions/setup-gradle@v3 - - - name: Get the current release version - id: release_version - run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - - - name: Run pre-release - uses: micronaut-projects/github-actions/pre-release@master - - - name: Generate secring file + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "📝 Store the current release version" + run: | + echo "Release version: ${GITHUB_REF:11}" + echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV + - name: "⚙️ Run pre-release" + uses: apache/grails-github-actions/pre-release@asf + - name: "🔐 Generate key file for artifact signing" env: SECRING_FILE: ${{ secrets.SECRING_FILE }} run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg - - - name: Publish artifacts to Sonatype - id: publish_to_sonatype + - name: "📤 Publish artifacts to Sonatype" env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + GRAILS_PUBLISH_RELEASE: 'true' + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} + NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} run: > @@ -43,24 +48,14 @@ jobs: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository - - - name: Generate Documentation - if: success() - env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "📖 Generate Documentation" run: ./gradlew docs - - - name: Publish Documentation to Github Pages - if: success() - uses: micronaut-projects/github-pages-deploy-action@grails + - name: "📤 Publish Documentation to Github Pages" + uses: apache/grails-github-actions/deploy-github-pages@asf env: - BRANCH: gh-pages - COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} - COMMIT_NAME: ${{ env.GIT_USER_NAME }} - FOLDER: build/docs/manual - GH_TOKEN: ${{ secrets.GH_TOKEN }} - VERSION: ${{ steps.release_version.outputs.release_version }} - - - name: Run post-release - if: steps.publish_to_sonatype.outcome == 'success' - uses: micronaut-projects/github-actions/post-release@master \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GRADLE_PUBLISH_RELEASE: 'true' + SOURCE_FOLDER: build/docs + VERSION: ${{ env.RELEASE_VERSION }} + - name: "⚙️ Run post-release" + uses: apache/grails-github-actions/post-release@asf \ No newline at end of file diff --git a/README.md b/README.md index 889f4fab..1b69a16f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Grails Mail Plugin [![Maven Central](https://img.shields.io/maven-central/v/org.grails.plugins/mail.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.grails.plugins/mail) -[![Java CI](https://github.com/grails/grails-mail/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/grails/grails-mail/actions/workflows/gradle.yml) +[![Java CI](https://github.com/grails-plugins/grails-mail/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/grails-plugins/grails-mail/actions/workflows/gradle.yml) ## About @@ -21,7 +21,7 @@ mailService.sendMail { ## Documentation -[Latest documentation](https://grails.github.io/grails-mail/latest/) and [snapshots](https://grails.github.io/grails-mail/snapshot/) are available. +[Latest documentation](https://grails-plugins.github.io/grails-mail/latest/) and [snapshots](https://grails-plugins.github.io/grails-mail/snapshot/) are available. ## Versions @@ -34,7 +34,7 @@ mailService.sendMail { ## Issues -Issues can be raised via [GitHub Issues](https://github.com/grails/grails-mail/issues). +Issues can be raised via [GitHub Issues](https://github.com/grails-plugins/grails-mail/issues). ## Contributing diff --git a/build.gradle b/build.gradle index 7ca9de56..902626aa 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ plugins { version = projectVersion group = 'org.grails.plugins' + ext.set('grailsVersion', libs.versions.grails.asProvider().get()) ext.set('isReleaseVersion', !version.toString().endsWith('-SNAPSHOT')) ext.set('isSnapshot', !isReleaseVersion) @@ -58,11 +59,13 @@ dependencies { tasks.withType(Test).configureEach { useJUnitPlatform() testLogging { - events 'passed', 'skipped', 'failed' + events('passed', 'skipped', 'failed') } } -apply from: layout.projectDirectory.file('gradle/java-config.gradle') -apply from: layout.projectDirectory.file('gradle/grails-plugin-config.gradle') -apply from: layout.projectDirectory.file('gradle/documentation-config.gradle') -apply from: layout.projectDirectory.file('gradle/publishing.gradle') +apply { + from layout.projectDirectory.file('gradle/java-config.gradle') + from layout.projectDirectory.file('gradle/grails-plugin-config.gradle') + from layout.projectDirectory.file('gradle/documentation-config.gradle') + from layout.projectDirectory.file('gradle/publishing.gradle') +} diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml index 3374bdbb..236b6059 100644 --- a/gradle/buildsrc.libs.versions.toml +++ b/gradle/buildsrc.libs.versions.toml @@ -1,6 +1,6 @@ [versions] -grails-gradle-plugin = '6.2.0' -nexus-publish-gradle-plugin = '1.3.0' +grails-gradle-plugin = '6.2.4' +nexus-publish-gradle-plugin = '2.0.0' [libraries] grails-gradle-plugin = { module = 'org.grails:grails-gradle-plugin', version.ref = 'grails-gradle-plugin' } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 61559a6c..a174e356 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,12 @@ [versions] -grails = '6.2.0' -grails-testing-support = '3.2.1' +grails = '6.2.3' +grails-testing-support = '3.2.2' greenmail = '1.6.15' -groovy = '3.0.21' +groovy = '3.0.25' gsp = '6.2.1' javamail = '1.6.2' slf4j = '1.7.36' -spring = '5.3.34' +spring = '5.3.39' springboot = '2.7.18' spock = '2.3-groovy-3.0' diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index df06f69d..c9776b02 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -8,14 +8,10 @@ publishing { publications { register('grailsMailPlugin', MavenPublication) { from javaComponent.get() - versionMapping { - usage('java-api') { fromResolutionOf('runtimeClasspath') } - usage('java-runtime') { fromResolutionResult() } - } pom { name = 'Grails Mail plugin' description = 'Provides Mail support to a running Grails application' - url = 'https://github.com/grails/grails-mail' + url = 'https://github.com/grails-plugins/grails-mail' licenses { license { name = 'The Apache License, Version 2.0' @@ -65,9 +61,9 @@ publishing { } } scm { - connection = 'scm:git:git://github.com/grails/grails-mail.git' - developerConnection = 'scm:git:ssh://github.com:grails/grails-mail.git' - url = 'https://github.com/grails/grails-mail' + connection = 'scm:git:git://github.com/grails-plugins/grails-mail.git' + developerConnection = 'scm:git:ssh://github.com:grails-plugins/grails-mail.git' + url = 'https://github.com/grails-plugins/grails-mail' } } // dependency management shouldn't be included @@ -82,10 +78,10 @@ publishing { repositories { maven { credentials { - username = findProperty('artifactoryPublishUsername') ?: '' - password = findProperty('artifactoryPublishPassword') ?: '' + username = System.getenv('MAVEN_PUBLISH_USERNAME') + password = System.getenv('MAVEN_PUBLISH_PASSWORD') } - url = uri('https://repo.grails.org/grails/plugins3-snapshots-local') + url = uri(System.getenv('MAVEN_PUBLISH_URL') ?: '') } } } @@ -104,15 +100,12 @@ afterEvaluate { if (isReleaseVersion) { nexusPublishing { - String sonatypeUsername = findProperty('sonatypeUsername') ?: '' - String sonatypePassword = findProperty('sonatypePassword') ?: '' - String sonatypeStagingProfileId = findProperty('sonatypeStagingProfileId') ?: '' repositories { sonatype { - nexusUrl = uri('https://s01.oss.sonatype.org/service/local/') - username = sonatypeUsername - password = sonatypePassword - stagingProfileId = sonatypeStagingProfileId + nexusUrl = uri(System.getenv('NEXUS_PUBLISH_URL') ?: '') + username = System.getenv('NEXUS_PUBLISH_USERNAME') + password = System.getenv('NEXUS_PUBLISH_PASSWORD') + stagingProfileId = System.getenv('NEXUS_PUBLISH_STAGING_PROFILE_ID') } } } diff --git a/settings.gradle b/settings.gradle index 99168869..48d138a3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,23 +1,26 @@ plugins { - id 'com.gradle.develocity' version '3.17.1' - id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0' + id 'com.gradle.develocity' version '4.0.2' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.3' } -def isCI = System.getenv('CI') == 'true' +def isCI = System.getenv().containsKey('CI') +def isLocal = !isCI develocity { server = 'https://ge.grails.org' buildScan { - publishing.onlyIf { isCI } - uploadInBackground = !isCI + tag('grails-plugins') + tag('grails-mail') + publishing.onlyIf { it.authenticated } + uploadInBackground = isLocal } } buildCache { - local { enabled = !isCI } + local { enabled = isLocal } remote(develocity.buildCache) { enabled = true - push = isCI && System.getenv('DEVELOCITY_ACCESS_KEY') + push = isCI } } diff --git a/src/main/groovy/grails/plugins/mail/MailGrailsPlugin.groovy b/src/main/groovy/grails/plugins/mail/MailGrailsPlugin.groovy index 2fb7483f..55e121cd 100644 --- a/src/main/groovy/grails/plugins/mail/MailGrailsPlugin.groovy +++ b/src/main/groovy/grails/plugins/mail/MailGrailsPlugin.groovy @@ -53,8 +53,8 @@ sendMail { [name: 'Mattias Reichel', email: 'mattias.reichel@gmail.com'] ] - def issueManagement = [system: 'GitHub', url: 'https://github.com/grails/grails-mail/issues'] - def scm = [url: 'https://github.com/grails/grails-mail'] + def issueManagement = [system: 'GitHub', url: 'https://github.com/grails-plugins/grails-mail/issues'] + def scm = [url: 'https://github.com/grails-plugins/grails-mail'] def observe = ['controllers', 'services']