diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 806ac14ef..449f26471 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -11,8 +11,12 @@ env: GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' jobs: test_project: - runs-on: ubuntu-latest + name: "Test Project" if: github.event_name == 'pull_request' + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - name: "📥 Checkout repository" uses: actions/checkout@v4 @@ -24,18 +28,18 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "🏃 Run Tests" 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - run: > - ./gradlew - check + run: ./gradlew check build_project: - runs-on: ubuntu-latest + name: "Build Project" if: github.event_name == 'push' + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - name: "📥 Checkout repository" uses: actions/checkout@v4 @@ -47,20 +51,14 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "🔨 Build project" 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - run: > - ./gradlew - build + run: ./gradlew build - name: "📤 Publish Snapshot Artifacts to Artifactory (repo.grails.org)" if: success() env: - DEVELOVITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} ORG_GRADLE_PROJECT_artifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }} ORG_GRADLE_PROJECT_artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} @@ -71,8 +69,6 @@ jobs: - name: "📖 Generate Snapshot Documentation" if: success() 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: > ./gradlew diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 162d8ab96..bda1978c8 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -9,9 +9,11 @@ on: workflow_dispatch: permissions: contents: read + packages: read jobs: build_groovy: - runs-on: ubuntu-latest + name: "Build Groovy" + runs-on: ubuntu-24.04 outputs: groovyVersion: ${{ steps.groovy-version.outputs.value }} steps: @@ -25,7 +27,7 @@ jobs: with: path: ~/.m2/repository key: cache-local-maven-${{ github.sha }} - - name: "📥 Checkout Grails Views to fetch Gradle Plugin versions it uses" + - name: "📥 Checkout this project to fetch Gradle Plugin versions it uses" uses: actions/checkout@v4 with: sparse-checkout-cone-mode: false @@ -68,27 +70,20 @@ jobs: run: | echo "VALUE<> $GITHUB_OUTPUT echo "def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null" >> $GITHUB_OUTPUT - echo "def isBuildCacheAuthenticated =" >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') != null &&" >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') != null" >> $GITHUB_OUTPUT - echo "" >> $GITHUB_OUTPUT echo "develocity {" >> $GITHUB_OUTPUT echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT echo " buildScan {" >> $GITHUB_OUTPUT + echo " tag('groovy')" >> $GITHUB_OUTPUT + echo " tag('grails-views')" >> $GITHUB_OUTPUT echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT echo " uploadInBackground = false" >> $GITHUB_OUTPUT echo " }" >> $GITHUB_OUTPUT echo "}" >> $GITHUB_OUTPUT - echo "" >> $GITHUB_OUTPUT echo "buildCache {" >> $GITHUB_OUTPUT echo " local { enabled = false }" >> $GITHUB_OUTPUT echo " remote(develocity.buildCache) {" >> $GITHUB_OUTPUT - echo " push = isBuildCacheAuthenticated" >> $GITHUB_OUTPUT + echo " push = isAuthenticated" >> $GITHUB_OUTPUT echo " enabled = true" >> $GITHUB_OUTPUT - echo " usernameAndPassword(" >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: ''," >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: ''" >> $GITHUB_OUTPUT - echo " )" >> $GITHUB_OUTPUT echo " }" >> $GITHUB_OUTPUT echo "}" >> $GITHUB_OUTPUT echo "" >> $GITHUB_OUTPUT @@ -105,17 +100,14 @@ jobs: # Add Develocity setup related configuration after line no 22 in gradle/build-scans.gradle echo "${{ steps.develocity-conf-2.outputs.value }}" | sed -i -e "22r /dev/stdin" gradle/build-scans.gradle - name: "🔨 Publish Groovy to local maven repository (no 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 }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: | cd groovy ./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK build_project: - needs: [build_groovy] - runs-on: ubuntu-latest + name: "Build Project" + needs: build_groovy + runs-on: ubuntu-24.04 steps: - name: "📥 Checkout project" uses: actions/checkout@v4 @@ -127,7 +119,7 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "🗄️ Restore local Maven repository from cache" uses: actions/cache@v4 with: @@ -137,11 +129,8 @@ jobs: run: sed -i 's|// mavenLocal() // Keep|mavenLocal() // Keep|' build.gradle - name: "🔨 Build and test Grails using the locally built Groovy snapshot" 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: > - ./gradlew - build + ./gradlew build -PgroovyVersion=${{needs.build_groovy.outputs.groovyVersion}} -x groovydoc \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 597d86c1a..7ee9f93f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,9 +7,13 @@ env: GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' jobs: publish: + name: "Publish to Sonatype Staging Repository" outputs: release_version: ${{ steps.release_version.outputs.value }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - name: "📥 Checkout repository" uses: actions/checkout@v4 @@ -21,7 +25,7 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "📝 Store the current release version" id: release_version run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT @@ -31,8 +35,6 @@ jobs: 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: ./gradlew assemble - name: "📤 Upload Distribution" @@ -47,25 +49,25 @@ jobs: run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg - name: "📤 Publish release artifacts to Sonatype" env: - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} ORG_GRADLE_PROJECT_sonatypeOssUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_sonatypeOssPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_sonatypeOssStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} ORG_GRADLE_PROJECT_sonatypeOssRepo: ${{ secrets.SONATYPE_NEXUS_URL }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: > ./gradlew -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeSonatypeStagingRepository release: + name: "Release Sonatype Staging Repository" needs: publish - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: - contents: read # limit to read access + contents: read + packages: read steps: - name: "📥 Checkout repository" uses: actions/checkout@v4 @@ -80,16 +82,14 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_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 }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} ORG_GRADLE_PROJECT_sonatypeOssUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_sonatypeOssPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_sonatypeOssStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} ORG_GRADLE_PROJECT_sonatypeOssRepo: ${{ secrets.SONATYPE_NEXUS_URL }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: > ./gradlew findSonatypeStagingRepository @@ -97,18 +97,17 @@ jobs: - name: "⚙️ Run post-release" if: success() uses: grails/github-actions/post-release@main - with: - token: ${{ secrets.GITHUB_TOKEN }} docs: + name: "Publish Documentation" needs: publish - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: write + packages: read steps: - name: "📥 Checkout 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 @@ -118,21 +117,16 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "📖 Generate Documentation" - if: success() 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - run: > - ./gradlew - views-docs:docs + run: ./gradlew views-docs:docs - name: "📤 Publish Documentation to Github Pages" if: success() uses: grails/github-pages-deploy-action@grails env: - BETA: ${{ contains(needs.publish.outputs.release_version, 'M') }} + BETA: ${{ contains(needs.publish.outputs.release_version, 'M') || contains(needs.publish.outputs.release_version, 'RC') }} BRANCH: gh-pages COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} COMMIT_NAME: ${{ env.GIT_USER_NAME }} diff --git a/build.gradle b/build.gradle index 47921a34f..22c340f25 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { group = 'org.grails' version = projectVersion -ext.set('grailsVersion', libs.versions.grails.asProvider().get()) +ext.set('grailsVersion', libs.versions.grails.get()) ext.set('isSnapshot', version.endsWith('-SNAPSHOT')) ext.set('isReleaseVersion', !isSnapshot) diff --git a/settings.gradle b/settings.gradle index a736802ff..10111b67d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,18 +1,17 @@ plugins { - id 'com.gradle.develocity' version '3.18.1' + id 'com.gradle.develocity' version '3.19' 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 { + tag('grails') + tag('grails-views') publishing.onlyIf { isAuthenticated } uploadInBackground = isLocal } @@ -21,31 +20,13 @@ develocity { buildCache { local { enabled = isLocal } remote(develocity.buildCache) { - push = isCI && isBuildCacheAuthenticated + push = isCI && isAuthenticated enabled = true - usernameAndPassword( - System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: '', - System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: '' - ) } } rootProject.name = 'grails-views' -dependencyResolutionManagement { - versionCatalogs { - libs { - // Make it possible to override the Groovy version - // via environment variable - def groovyVersion = System.getenv('GROOVY_VERSION') - if (groovyVersion) { - logger.warn "Using custom version $groovyVersion of Groovy due to GROOVY_VERSION being set." - version('groovy', groovyVersion) - } - } - } -} - ['core', 'json', 'docs', 'json-testing-support', 'markup'].each {dirName -> include("views-$dirName") project(":views-$dirName").projectDir = file(dirName)