diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..4a4607ae --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,73 @@ +name: Java CI +on: + push: + branches: + - '[5-9].[0-9].x' + pull_request: + branches: + - '[5-9].[0-9].x' + workflow_dispatch: +env: + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ”¨ Run Build" + env: + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: ./gradlew check + publish: + if: github.event_name == 'push' + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ“€ Publish to Snapshot (repo.grails.org)" + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} + MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} + MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }} + working-directory: ./plugin + run: ../gradlew publish + - name: "πŸ“œ Generate Documentation" + if: success() + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + working-directory: ./plugin + run: ../gradlew docs + - name: "πŸš€ Publish to Github Pages" + if: success() + uses: micronaut-projects/github-pages-deploy-action@grails + env: + SKIP_SNAPSHOT: ${{ contains(needs.publish.outputs.release_version, 'M') }} + TARGET_REPOSITORY: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + BRANCH: gh-pages + FOLDER: plugin/build/docs + DOC_FOLDER: gh-pages + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..da676518 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,156 @@ +name: Release +on: + release: + types: [published] +env: + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' +jobs: + publish: + permissions: + contents: write # to create release + issues: write # to modify milestones + runs-on: ubuntu-latest + outputs: + release_version: ${{ steps.release_version.outputs.value }} + target_branch: ${{ steps.extract_branch.outputs.value }} + env: + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' + steps: + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ“ Store the target branch" + id: extract_branch + run: | + echo "Determining Target Branch" + TARGET_BRANCH=${GITHUB_REF#refs/heads/} + echo $TARGET_BRANCH + echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT + - name: "πŸ“Set the current release version" + id: release_version + run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT + - name: "βš™οΈ Run pre-release" + uses: micronaut-projects/github-actions/pre-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: "🧩 Run Assemble" + if: success() + id: assemble + env: + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: ./gradlew assemble + - name: "πŸ“ Generate secring file" + env: + SECRING_FILE: ${{ secrets.SECRING_FILE }} + run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg + - name: "πŸš€ Publish to Sonatype OSSRH" + id: publish + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + SECRING_FILE: ${{ secrets.SECRING_FILE }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + working-directory: ./plugin + run: > + ../gradlew + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg + publishToSonatype + closeSonatypeStagingRepository + release: + needs: publish + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: liberica + java-version: 17 + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + ref: v${{ needs.publish.outputs.release_version }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "πŸ†Nexus Staging Close And Release" + env: + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + working-directory: ./plugin + run: > + ../gradlew + findSonatypeStagingRepository + releaseSonatypeStagingRepository + - name: "βš™οΈRun post-release" + if: success() + uses: micronaut-projects/github-actions/post-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + env: + SNAPSHOT_SUFFIX: -SNAPSHOT + docs: + needs: publish + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + ref: v${{ needs.publish.outputs.release_version }} + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + - name: "πŸ“œ Generate Documentation" + id: docs + env: + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + working-directory: ./plugin + run: ../gradlew docs + - name: "πŸš€ Publish to Github Pages" + id: docs + if: success() + uses: grails/github-pages-deploy-action@v2 + env: + SKIP_SNAPSHOT: ${{ contains(needs.publish.outputs.release_version, 'M') }} + # if multiple releases are being done, this is the last branch - 1 version + #SKIP_LATEST: ${{ !startsWith(needs.publish.outputs.target_branch, '6.2') }} + TARGET_REPOSITORY: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + BRANCH: gh-pages + FOLDER: plugin/build/docs + DOC_FOLDER: gh-pages + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} + VERSION: ${{ needs.publish.outputs.release_version }} \ No newline at end of file diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 00000000..96e716dc --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1,2 @@ +# Enable auto-env through the sdkman_auto_env config - https://sdkman.io/usage#env +java=17.0.12-librca diff --git a/README.md b/README.md index a08c1e14..ebe3cf34 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -# Grails Audit Logging Plugin +Grails Audit Logging Plugin +=== +[![Java CI](https://github.com/grails/grails-core/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/grails/grails-core/actions/workflows/gradle.yml) +![Grails 7 Compatible](https://img.shields.io/badge/Compatible-brightGreen?label=Grails%207&labelColor=grey) -This plugin was originally maintained by [symentis](https://github.com/symentis) and was gracefully donated to the GPC +This plugin was originally maintained by [symentis](https://github.com/symentis) and was gracefully donated to the grails developers to maintain. ## Description @@ -9,8 +12,9 @@ The Audit Logging plugin for Grails adds generic event based Audit Logging to a The master branch holds the codebase for plugin version 4.0.x (Grails 4.0.x). For older Grails versions, see "Supported Grails Versions" below. + ## Moving to Maven Central -This repositories new artifacts are currently moved to Maven Central, sind Bintray will shut down MAY/01/21. You can obtain the old artifacts from https://repo.grails.org. +This repositories new artifacts are currently moved to Maven Central, since Bintray shut down MAY/01/21. You can obtain the old artifacts from https://repo.grails.org. ## Documentation * For current release documentation, see [User Guide](https://gpc.github.io/grails-audit-logging-plugin/latest/plugin.html) diff --git a/gradle.properties b/gradle.properties index 743f047d..7918b788 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,3 @@ gradleWrapperVersion=8.11 org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M - -vcsUrl=https://github.com/gpc/grails-audit-logging-plugin -websiteUrl=https://github.com/gpc/grails-audit-logging-plugin -issueTrackerUrl=https://github.com/gpc/grails-audit-logging-plugin/issues diff --git a/gradle/artifactoryPublish.gradle b/gradle/artifactoryPublish.gradle deleted file mode 100644 index 4bc4a8aa..00000000 --- a/gradle/artifactoryPublish.gradle +++ /dev/null @@ -1,13 +0,0 @@ -artifactory { - contextUrl = 'https://oss.jfrog.org' - publish { - repository { - repoKey = 'oss-snapshot-local' - username = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : '' - password = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : '' - } - defaults { - publications('maven') - } - } -} \ No newline at end of file diff --git a/gradle/grailsPublish.gradle b/gradle/grailsPublish.gradle deleted file mode 100644 index 286b0b37..00000000 --- a/gradle/grailsPublish.gradle +++ /dev/null @@ -1,22 +0,0 @@ -def setIfNotSet = { String name, value -> - if (!project.ext.has(name)) { - project.ext[name] = value - } -} -setIfNotSet 'issueTrackerUrl', project.vcsUrl + '/issues' -setIfNotSet 'websiteUrl', project.vcsUrl - -grailsPublish { - user = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : '' - key = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : '' - githubSlug = 'gpc/grails-audit-logging-plugin' - websiteUrl = project.hasProperty('websiteUrl') ? project.websiteUrl : "https://grails.org/plugin/$project.name" - license { - name = project.hasProperty('license') ? [project.license] : ['Apache-2.0'] - } - issueTrackerUrl = project.hasProperty('issueTrackerUrl') ? project.issueTrackerUrl : "https://github.com/grails-plugins/$project.name/issues" - vcsUrl = project.hasProperty('vcsUrl') ? project.vcsUrl : "https://github.com/gpc/$project.name" - title = "Grails Audit-Logging Plugin" - desc = "Grails Audit-Logging Plugin for Grails 4.x" - developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"] -} \ No newline at end of file diff --git a/makedoc.sh b/makedoc.sh deleted file mode 100755 index 09b0026f..00000000 --- a/makedoc.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -set -ex - -TRAVIS_BRANCH=`git rev-parse --abbrev-ref HEAD` -TRAVIS_PULL_REQUEST="false" - -./gradlew -q clean check install --stacktrace - -EXIT_STATUS=0 -echo "Publishing archives for branch $TRAVIS_BRANCH" -if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then - - echo "Publishing archives" - - if [[ -n $TRAVIS_TAG ]]; then - echo "Publishing to Bintray.." - ./gradlew audit-logging:bintrayUpload -S || EXIT_STATUS=$? - else - echo "Publishing to Grails Artifactory" -# ./gradlew audit-logging:publish -S || EXIT_STATUS=$? - fi - - ./gradlew docs --stacktrace || EXIT_STATUS=$? - - git config --global user.name "$GIT_NAME" - git config --global user.email "$GIT_EMAIL" - git config --global credential.helper "store --file=~/.git-credentials" - echo "https://$GH_TOKEN:@github.com" > ~/.git-credentials - - echo " " - echo "** Updating gh-pages branch **" - pushd plugin/build - git clone https://github.com/gpc/grails-audit-logging-plugin.git -b gh-pages gh-pages --single-branch > /dev/null - cd gh-pages - - # prepare index.html - mv ../docs/index.html ../docs/plugin.html - mv ../docs/ghpages.html ../docs/index.html - - # If this is the master branch then update the snapshot - if [[ $TRAVIS_BRANCH == 'master' ]]; then - mkdir -p snapshot - cp -r ../docs/. ./snapshot/ - git add snapshot/* - fi - - # If there is a tag present then this becomes the latest - if [[ -n $TRAVIS_TAG ]]; then - mkdir -p latest - cp -r ../docs/. ./latest/ - git add latest/* - - version="$TRAVIS_TAG" - version=${version:1} - majorVersion=${version:0:4} - majorVersion="${majorVersion}x" - - mkdir -p "$version" - cp -r ../docs/. "./$version/" - git add "$version/*" - - mkdir -p "$majorVersion" - cp -r ../docs/. "./$majorVersion/" - git add "$majorVersion/*" - - fi - - git commit -a -m "Updating docs manually from ${TRAVIS_BRANCH} #noref" - git push origin HEAD - cd .. - rm -rf gh-pages - popd -fi -exit $EXIT_STATUS diff --git a/plugin/build.gradle b/plugin/build.gradle index f5aa63e8..34a97043 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -14,7 +14,6 @@ plugins { id "org.asciidoctor.jvm.convert" version "$asciidoctorJvmVersion" id "org.asciidoctor.jvm.pdf" version "$asciidoctorJvmVersion" id "org.asciidoctor.jvm.epub" version "$asciidoctorJvmVersion" - id "com.jfrog.artifactory" version "$artifactoryVersion" } version project.projectVersion @@ -23,7 +22,6 @@ group "org.grails.plugins" apply plugin: "eclipse" apply plugin: "idea" apply plugin: "org.grails.grails-plugin" -apply plugin:"org.grails.internal.grails-plugin-publish" apply plugin: "org.grails.grails-gsp" ext { @@ -76,6 +74,15 @@ task wrapper(type: Wrapper) { gradleVersion = gradleWrapperVersion } -apply from: "${rootProject.projectDir}/gradle/grailsPublish.gradle" -apply from: "${rootProject.projectDir}/gradle/artifactoryPublish.gradle" +apply plugin: "org.grails.grails-publish" +grailsPublish { + githubSlug = 'grails-plugins/grails-audit-logging-plugin' + license { + name = 'Apache-2.0' + } + title = "Grails Audit-Logging Plugin" + desc = "Grails Audit-Logging Plugin for Grails 7+" + developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"] +} + apply from: "${rootProject.projectDir}/gradle/docs.gradle" \ No newline at end of file diff --git a/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy b/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy index 8f542810..7def8eee 100755 --- a/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy +++ b/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy @@ -42,7 +42,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException @Slf4j @SuppressWarnings("GroovyUnusedDeclaration") class AuditLoggingGrailsPlugin extends Plugin { - def grailsVersion = '4.0.0 > *' + def grailsVersion = '7.0.0 > *' def title = "Audit Logging Plugin" def authorEmail = "roos@symentis.com" diff --git a/settings.gradle b/settings.gradle index 98a4f75f..a5553f8b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,35 @@ +plugins { + id 'com.gradle.develocity' version '3.18.1' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2' +} + +def isCI = System.getenv('CI') != null +def isLocal = !isCI +def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null +def isBuildCacheAuthenticated = + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') != null && + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') != null + +develocity { + server = 'https://ge.grails.org' + buildScan { + publishing.onlyIf { isAuthenticated } + uploadInBackground = isLocal + } +} + +buildCache { + local { enabled = isLocal } + remote(develocity.buildCache) { + push = isCI && isBuildCacheAuthenticated + enabled = true + usernameAndPassword( + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: '', + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: '' + ) + } +} + rootProject.name = 'grails-audit-logging' include 'plugin'