From d4415080c6a3d1efb323d2e88eed0610481abd9d Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 1 Jan 2025 16:10:39 +0100 Subject: [PATCH 1/7] ci: Update `groovy-joint-workflow` And also go over and update the rest of the workflows. --- .github/workflows/gradle.yml | 113 +++++++----- .github/workflows/groovy-joint-workflow.yml | 187 +++++++++----------- .github/workflows/release.yml | 136 +++++++++----- build.gradle | 21 ++- settings.gradle | 27 ++- 5 files changed, 269 insertions(+), 215 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 350389d8..cab008ee 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,4 +1,4 @@ -name: Java CI +name: "Java CI" on: push: branches: @@ -7,62 +7,85 @@ on: branches: - '[5-9]+.[0-9]+.x' jobs: - build_project: - name: Build Project - runs-on: ubuntu-latest - strategy: - fail-fast: true + build: + name: "Build Project" + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - uses: actions/setup-java@v4 + - name: "ðŸ“Ĩ Checkout the repository" + uses: actions/checkout@v4 + - name: "☕ïļ Setup JDK" + uses: actions/setup-java@v4 with: - distribution: liberica - java-version: 17 - - name: Run Gradle build - uses: gradle/actions/setup-gradle@v3 + distribution: 'liberica' + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "ðŸ”Ļ Run Build" + id: build env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - with: - arguments: build - publish_documentation: - name: Publish Snapshot release - runs-on: ubuntu-latest + run: ./gradlew build + publish: if: github.event_name == 'push' - needs: build_project + needs: build + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - uses: actions/setup-java@v4 + - name: "ðŸ“Ĩ Checkout the repository" + uses: actions/checkout@v4 + - name: "☕ïļ Setup JDK" + uses: actions/setup-java@v4 with: - distribution: liberica - java-version: 17 - - name: Publish to Artifactory (repo.grails.org) - uses: gradle/actions/setup-gradle@v3 - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - ORG_GRADLE_PROJECT_artifactoryPublishUsername: ${{ secrets.ARTIFACTORY_USERNAME }} - ORG_GRADLE_PROJECT_artifactoryPublishPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} + distribution: 'liberica' + java-version: '17' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 with: - arguments: | - -Dorg.gradle.internal.publish.checksums.insecure=true - publish - - name: Generate Documentation - if: success() - uses: gradle/actions/setup-gradle@v3 + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "ðŸ“Ī Publish Snapshot to repo.grails.org" env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + run: ./gradlew publish + docs: + if: github.event_name == 'push' + needs: build + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: 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 with: - arguments: docs - - name: Publish to Github Pages - if: success() - uses: grails/github-pages-deploy-action@grails + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "ðŸ”Ļ Build Docs" + id: docs + env: + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew docs + - name: "ðŸ“Ī Publish docs to Github Pages" + if: steps.docs.outcome == 'success' + uses: grails/github-pages-deploy-action@v2 env: TARGET_REPOSITORY: ${{ github.repository }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages FOLDER: docs/build/docs - DOC_FOLDER: gh-pages - COMMIT_EMAIL: 'grails-build@users.noreply.github.com' - COMMIT_NAME: 'grails-build' \ No newline at end of file + COMMIT_EMAIL: grails-build@users.noreply.github.com + COMMIT_NAME: grails-build \ No newline at end of file diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 37701478..aebad29e 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -9,142 +9,125 @@ on: workflow_dispatch: permissions: contents: read -env: - CI_GROOVY_VERSION: + packages: read jobs: build_groovy: - strategy: - fail-fast: true - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: groovyVersion: ${{ steps.groovy-version.outputs.value }} steps: - - - name: Set up JDK + - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: temurin + distribution: liberica java-version: 17 - - - name: Cache local Maven repository & Groovy + - name: "🗄ïļ Cache local Maven repository" uses: actions/cache@v4 with: - path: | - ~/groovy - ~/.m2/repository - key: cache-local-groovy-maven-${{ github.sha }} - - name: Checkout Groovy 4_0_X (Grails 7 and later) - run: cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_4_0_X --single-branch - - name: Set CI_GROOVY_VERSION for Grails + path: ~/.m2/repository + key: cache-local-maven-${{ github.sha }} + - name: "ðŸ“Ĩ Checkout this project to fetch Gradle Plugin versions it uses" + uses: actions/checkout@v4 + with: + sparse-checkout-cone-mode: false + sparse-checkout: settings.gradle + - name: "📝 Store the Gradle Plugin versions used in this project" + id: gradle-plugin-versions + run: | + DEVELOCITY_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.develocity\"\|'"'com.gradle.develocity'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:]) + COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.common-custom-user-data-gradle-plugin\"\|'"'com.gradle.common-custom-user-data-gradle-plugin'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:]) + echo "Project uses Develocity Plugin version: $DEVELOCITY_PLUGIN_VERSION" + echo "Project uses Common Custom User Data Plugin version: $COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION" + echo "develocity_plugin_version=$DEVELOCITY_PLUGIN_VERSION" >> $GITHUB_OUTPUT + echo "common_custom_user_data_plugin_version=$COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION" >> $GITHUB_OUTPUT + rm settings.gradle + - name: "ðŸ“Ĩ Checkout Groovy 4_0_X (Grails 7 and later)" + run: git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_4_0_X --single-branch + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "📝 Store Groovy version to use when building this project" id: groovy-version run: | - cd ../groovy - echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV - echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT - - name: Prepare Develocity Setup 1 - id: develocity_conf_1 + cd groovy + GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]') + echo "Groovy version $GROOVY_VERSION stored" + echo "value=$GROOVY_VERSION" >> $GITHUB_OUTPUT + - name: "🐘 Configure Gradle Plugins (Step 1/3)" + id: develocity-conf-1 run: | echo "VALUE<> $GITHUB_OUTPUT echo "plugins { " >> $GITHUB_OUTPUT - echo " id 'com.gradle.enterprise' version '3.15.1'" >> $GITHUB_OUTPUT - echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.11.3'" >> $GITHUB_OUTPUT + echo " id 'com.gradle.develocity' version '${{ steps.gradle-plugin-versions.outputs.develocity_plugin_version }}'" >> $GITHUB_OUTPUT + echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '${{ steps.gradle-plugin-versions.outputs.common_custom_user_data_plugin_version }}'" >> $GITHUB_OUTPUT echo "}" >> $GITHUB_OUTPUT echo "" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Prepare Develocity Setup 2 - id: develocity_conf_2 + - name: "🐘 Configure Gradle Plugins (Step 2/3)" + id: develocity-conf-2 run: | echo "VALUE<> $GITHUB_OUTPUT - echo "gradleEnterprise {" >> $GITHUB_OUTPUT - echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT - echo " buildScan {" >> $GITHUB_OUTPUT - echo " publishAlways()" >> $GITHUB_OUTPUT - echo " publishIfAuthenticated()" >> $GITHUB_OUTPUT - echo " uploadInBackground = System.getenv('CI') == null" >> $GITHUB_OUTPUT - echo " capture {" >> $GITHUB_OUTPUT - echo " taskInputFiles = true" >> $GITHUB_OUTPUT - echo " }" >> $GITHUB_OUTPUT - echo " }" >> $GITHUB_OUTPUT - echo "}" >> $GITHUB_OUTPUT - echo "" >> $GITHUB_OUTPUT - echo "buildCache {" >> $GITHUB_OUTPUT - echo " local { enabled = System.getenv('CI') != 'true' }" >> $GITHUB_OUTPUT - echo " remote(HttpBuildCache) {" >> $GITHUB_OUTPUT - echo " push = System.getenv('CI') == 'true'" >> $GITHUB_OUTPUT - echo " enabled = true" >> $GITHUB_OUTPUT - echo " url = 'https://ge.grails.org/cache/'" >> $GITHUB_OUTPUT - echo " credentials {" >> $GITHUB_OUTPUT - echo " username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')" >> $GITHUB_OUTPUT - echo " password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')" >> $GITHUB_OUTPUT - echo " }" >> $GITHUB_OUTPUT - echo " }" >> $GITHUB_OUTPUT - echo "}" >> $GITHUB_OUTPUT + echo "def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null" >> $GITHUB_OUTPUT + echo "develocity {" >> $GITHUB_OUTPUT + echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT + echo " buildScan {" >> $GITHUB_OUTPUT + echo " tag('groovy') + echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT + echo " uploadInBackground = false" >> $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 = isAuthenticated" >> $GITHUB_OUTPUT + echo " enabled = true" >> $GITHUB_OUTPUT + echo " }" >> $GITHUB_OUTPUT + echo "}" >> $GITHUB_OUTPUT echo "" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Develocity Set-up + - name: "🐘 Configure Gradle Plugins (step 3/3)" run: | - cd ../groovy + cd groovy # Delete existing plugins from settings.gradle file sed -i '32,37d' settings.gradle - # Add Gradle Enterprise set-up related configuration after line no 31 in settings.gradle - echo "${{ steps.develocity_conf_1.outputs.value }}" | sed -i -e "31r /dev/stdin" settings.gradle + # Add Develocity setup related configuration after line no 31 in settings.gradle + echo "${{ steps.develocity-conf-1.outputs.value }}" | sed -i -e "31r /dev/stdin" settings.gradle # Delete existing buildCache configuration from gradle/build-scans.gradle file sed -i '23,46d' gradle/build-scans.gradle - # Add Gradle Enterprise set-up 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: Build and install groovy (no docs) - uses: gradle/gradle-build-action@v3 - env: - GRADLE_SCANS_ACCEPT: yes - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - with: - build-root-directory: ../groovy - arguments: | - publishToMavenLocal - -x groovydoc - -x javadoc - -x javadocAll - -x groovydocAll - -x asciidoc - -x docGDK + # 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)" + run: | + cd groovy + ./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK build_project: - needs: [build_groovy] - strategy: - fail-fast: true - runs-on: ubuntu-latest + needs: build_groovy + runs-on: ubuntu-24.04 steps: - - - uses: actions/checkout@v4 - - - name: Set up JDK + - name: "ðŸ“Ĩ Checkout project" + uses: actions/checkout@v4 + - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: temurin + distribution: liberica java-version: 17 - - - name: Cache local Maven repository & Groovy + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "🗄ïļ Restore local Maven repository from cache" uses: actions/cache@v4 with: - path: | - ~/groovy - ~/.m2/repository - key: cache-local-groovy-maven-${{ github.sha }} - - name: Set CI_GROOVY_VERSION for Grails - run: | - echo "CI_GROOVY_VERSION=${{needs.build_groovy.outputs.groovyVersion}}" >> $GITHUB_ENV - - name: Build GORM - id: build_gorm - uses: gradle/gradle-build-action@v3 + path: ~/.m2/repository + key: cache-local-maven-${{ github.sha }} + - name: "ðŸŠķ Add mavenLocal repository to build" + run: sed -i 's|// mavenLocal() // Keep|mavenLocal() // Keep|' build.gradle + - name: "ðŸ”Ļ Build and test project using the locally built Groovy snapshot" env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - with: - arguments: | - build - -x groovydoc \ No newline at end of file + run: > + ./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 2c235831..8476d145 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,72 +1,118 @@ -name: Release +name: "Release" on: release: types: [published] +env: + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' jobs: - release: - runs-on: ubuntu-latest - env: - GIT_USER_NAME: 'grails-build' - GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' + publish: + outputs: + release_version: ${{ steps.release_version.outputs.value }} + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - uses: actions/setup-java@v4 + - name: "ðŸ“Ĩ Checkout the repository" + uses: actions/checkout@v4 + - name: "☕ïļ Setup JDK" + uses: actions/setup-java@v4 with: - distribution: temurin - java-version: 17 - - - name: Set the current release version + distribution: 'liberica' + java-version: '17' + - name: "📝 Store the current release version" id: release_version - run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - - - name: Run pre-release + run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "⚙ Run pre-release" uses: grails/github-actions/pre-release@main - - - name: Generate secring file + - 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 to Sonatype - id: publish_to_sonatype - uses: gradle/actions/setup-gradle@v3 + - name: "Publish to and close Sonatype staging repository" + id: publish env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} 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: + needs: publish + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read + steps: + - name: "ðŸ“Ĩ Checkout repository" + uses: actions/checkout@v4 with: - arguments: | - -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg - publishToSonatype - closeAndReleaseSonatypeStagingRepository - - - name: Generate Documentation - if: success() - uses: gradle/actions/setup-gradle@v3 + 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 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "🚀 Release Sonatype Staging Repository" env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + run: > + ./gradlew + findSonatypeStagingRepository + releaseSonatypeStagingRepository + - name: "⚙ïļ Run post-release" + if: success() + uses: grails/github-actions/post-release@main + docs: + needs: publish + runs-on: ubuntu-24.04 + permissions: + contents: write + packages: read + steps: + - name: "ðŸ“Ĩ Checkout repository" + uses: actions/checkout@v4 with: - arguments: docs - - - name: Publish Documentation to Github Pages + 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 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "📖 Generate documentation" + env: + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew docs + - name: "ðŸ“Ī Publish documentation to Github Pages" if: success() uses: grails/github-pages-deploy-action@grails env: - TARGET_REPOSITORY: ${{ github.repository }} + BETA: ${{ contains(needs.publish.outputs.release_version, 'M') || contains(needs.publish.outputs.release_version, 'RC') }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages FOLDER: docs/build/docs - VERSION: ${{ steps.release_version.outputs.release_version }} - DOC_FOLDER: gh-pages - COMMIT_EMAIL: 'grails-build@users.noreply.github.com' - COMMIT_NAME: 'grails-build' - - - name: Run post-release - if: steps.publish_to_sonatype.outcome == 'success' - uses: grails/github-actions/post-release@main \ No newline at end of file + VERSION: ${{ needs.publish.outputs.release_version }} + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index ecca75b9..36d36cd2 100644 --- a/build.gradle +++ b/build.gradle @@ -12,9 +12,9 @@ ext.set('isReleaseVersion', !isSnapshot) if(isReleaseVersion) { nexusPublishing { - String nexusUser = System.getenv("SONATYPE_USERNAME") - String nexusPass = System.getenv("SONATYPE_PASSWORD") - String nexusStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") + String nexusUser = System.getenv('SONATYPE_USERNAME') + String nexusPass = System.getenv('SONATYPE_PASSWORD') + String nexusStagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID') repositories { sonatype { nexusUrl = uri('https://s01.oss.sonatype.org/service/local/') @@ -32,22 +32,25 @@ subprojects { version = rootProject.version repositories { - mavenLocal() // Used by Groovy Joint Workflow mavenCentral() maven { url = 'https://repo.grails.org/grails/core' } + // mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow) if (libs.versions.groovy.get().endsWith('-SNAPSHOT')) { + // Used for testing locally against the latest snapshot of Groovy + // Usage: ./gradlew -PgroovyVersion=X.X.X-SNAPSHOT build maven { - name = 'JFrog Groovy snapshot repo' - url = 'https://groovy.jfrog.io/artifactory/libs-snapshot-local/' + name = 'ASF Snapshot repo' + url = 'https://repository.apache.org/content/repositories/snapshots' } } - if (System.getenv("GITHUB_MAVEN_PASSWORD") && !grailsVersion.endsWith('-SNAPSHOT')) { - System.out.println("Adding Grails Core Repo") + if (System.getenv('GITHUB_MAVEN_PASSWORD') && !grailsVersion.endsWith('-SNAPSHOT')) { + // Used during the release process to access modules temporarily published to GitHub Packages + System.out.println('Adding Grails Core Repo') maven { url = 'https://maven.pkg.github.com/grails/grails-core' credentials { username = 'DOES_NOT_MATTER' - password = System.getenv("GITHUB_MAVEN_PASSWORD") + password = System.getenv('GITHUB_MAVEN_PASSWORD') } } } diff --git a/settings.gradle b/settings.gradle index 20646172..9ac48039 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,25 +1,24 @@ plugins { - id "com.gradle.enterprise" version '3.16.2' - id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13' + id 'com.gradle.develocity' version '3.19' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2' } -gradleEnterprise { +def isCI = System.getenv('CI') != null +def isLocal = !isCI +def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null +develocity { server = 'https://ge.grails.org' buildScan { - publishAlwaysIf(System.getenv('CI') == 'true') - publishIfAuthenticated() - uploadInBackground = System.getenv('CI') == null - capture { - taskInputFiles = true - } + tag('grails') + tag('grails-async') + publishing.onlyIf { isAuthenticated } + uploadInBackground = isLocal } } - buildCache { - local { enabled = System.getenv('CI') != 'true' } - remote(gradleEnterprise.buildCache) { - def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY') - push = System.getenv('CI') == 'true' && isAuthenticated + local { enabled = isLocal } + remote(develocity.buildCache) { + push = isCI && isAuthenticated enabled = true } } From a0b060d96e88d2a1caa600b6d859a51de0fb44db Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 1 Jan 2025 16:16:08 +0100 Subject: [PATCH 2/7] ci: fix error in `groovy-joint-workflow` --- .github/workflows/groovy-joint-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index aebad29e..42a9ca6f 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -72,7 +72,7 @@ jobs: echo "develocity {" >> $GITHUB_OUTPUT echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT echo " buildScan {" >> $GITHUB_OUTPUT - echo " tag('groovy') + echo " tag('groovy')" >> $GITHUB_OUTPUT echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT echo " uploadInBackground = false" >> $GITHUB_OUTPUT echo " }" >> $GITHUB_OUTPUT From f450ffc79062de6ef4c09529984f5279efbf1bbc Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 1 Jan 2025 16:17:44 +0100 Subject: [PATCH 3/7] ci: add tag `grails-async` in `groovy-joint-workflow` --- .github/workflows/groovy-joint-workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 42a9ca6f..85bf4965 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -73,6 +73,7 @@ jobs: echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT echo " buildScan {" >> $GITHUB_OUTPUT echo " tag('groovy')" >> $GITHUB_OUTPUT + echo " tag('grails-async')" >> $GITHUB_OUTPUT echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT echo " uploadInBackground = false" >> $GITHUB_OUTPUT echo " }" >> $GITHUB_OUTPUT From 42a83de1b1157d98f739a72d192a06b0904d2074 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 1 Jan 2025 16:24:19 +0100 Subject: [PATCH 4/7] ci: add proper job names in workflows --- .github/workflows/gradle.yml | 2 ++ .github/workflows/groovy-joint-workflow.yml | 2 ++ .github/workflows/release.yml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index cab008ee..16433fef 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -31,6 +31,7 @@ jobs: GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: ./gradlew build publish: + name: "Publish Snapshot" if: github.event_name == 'push' needs: build runs-on: ubuntu-24.04 @@ -56,6 +57,7 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} run: ./gradlew publish docs: + name: "Publish Snapshot Documentation" if: github.event_name == 'push' needs: build runs-on: ubuntu-24.04 diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 85bf4965..45d56bed 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -12,6 +12,7 @@ permissions: packages: read jobs: build_groovy: + name: "Build Groovy" runs-on: ubuntu-24.04 outputs: groovyVersion: ${{ steps.groovy-version.outputs.value }} @@ -104,6 +105,7 @@ jobs: ./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK build_project: + name: "Build Project" needs: build_groovy runs-on: ubuntu-24.04 steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8476d145..f6a15de9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ 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-24.04 @@ -49,6 +50,7 @@ jobs: publishToSonatype closeSonatypeStagingRepository release: + name: "Release Sonatype Staging Repository" needs: publish runs-on: ubuntu-24.04 permissions: @@ -82,6 +84,7 @@ jobs: if: success() uses: grails/github-actions/post-release@main docs: + name: "Publish Documentation" needs: publish runs-on: ubuntu-24.04 permissions: From 3fe24e4f9f90ee2afd6e928e369b2325d5bd7358 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 1 Jan 2025 16:48:30 +0100 Subject: [PATCH 5/7] build: make groovy version configurable Make the groovy version configurable by property or env variable. --- build.gradle | 7 ++++++- settings.gradle | 12 ------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 36d36cd2..49c389c0 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,11 @@ ext.set('grailsVersion', libs.versions.grails.get()) ext.set('isSnapshot', projectVersion.endsWith('-SNAPSHOT')) ext.set('isReleaseVersion', !isSnapshot) +def groovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION') +if (groovyVersion) { + ext.set('groovy.version', groovyVersion) +} + if(isReleaseVersion) { nexusPublishing { String nexusUser = System.getenv('SONATYPE_USERNAME') @@ -35,7 +40,7 @@ subprojects { mavenCentral() maven { url = 'https://repo.grails.org/grails/core' } // mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow) - if (libs.versions.groovy.get().endsWith('-SNAPSHOT')) { + if (groovyVersion?.endsWith('-SNAPSHOT')) { // Used for testing locally against the latest snapshot of Groovy // Usage: ./gradlew -PgroovyVersion=X.X.X-SNAPSHOT build maven { diff --git a/settings.gradle b/settings.gradle index 9ac48039..0533c53e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,18 +25,6 @@ buildCache { rootProject.name = 'grails-async' -dependencyResolutionManagement { - versionCatalogs { - libs { - 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) - } - } - } -} - include 'docs' include 'grails-async-core' include 'grails-async-gpars' From 999140fac91206a56ffb41ec14305fc096f06df3 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 1 Jan 2025 21:27:21 +0100 Subject: [PATCH 6/7] build: enforce Groovy version override Setting `groovy.version` property does not seem to suffice to override the groovy version in the bom. --- build.gradle | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 49c389c0..21eed731 100644 --- a/build.gradle +++ b/build.gradle @@ -10,12 +10,12 @@ ext.set('grailsVersion', libs.versions.grails.get()) ext.set('isSnapshot', projectVersion.endsWith('-SNAPSHOT')) ext.set('isReleaseVersion', !isSnapshot) -def groovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION') -if (groovyVersion) { - ext.set('groovy.version', groovyVersion) +String customGroovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION') +if (customGroovyVersion) { + logger.warn("Using custom Groovy version: $customGroovyVersion") } -if(isReleaseVersion) { +if (isReleaseVersion) { nexusPublishing { String nexusUser = System.getenv('SONATYPE_USERNAME') String nexusPass = System.getenv('SONATYPE_PASSWORD') @@ -36,13 +36,24 @@ subprojects { apply plugin: 'groovy' version = rootProject.version + + if (customGroovyVersion) { + configurations.configureEach { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if (details.requested.group == 'org.apache.groovy') { + details.useVersion(customGroovyVersion) + } + } + } + } + repositories { mavenCentral() maven { url = 'https://repo.grails.org/grails/core' } // mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow) - if (groovyVersion?.endsWith('-SNAPSHOT')) { + if (customGroovyVersion?.endsWith('-SNAPSHOT')) { // Used for testing locally against the latest snapshot of Groovy - // Usage: ./gradlew -PgroovyVersion=X.X.X-SNAPSHOT build + // Usage: ./gradlew build -P"groovyVersion=X.X.X-SNAPSHOT" maven { name = 'ASF Snapshot repo' url = 'https://repository.apache.org/content/repositories/snapshots' From e5d403b371ce3e5263a08bd2e652f1b497be14fb Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Thu, 2 Jan 2025 00:12:57 +0100 Subject: [PATCH 7/7] build: pr feedback --- .github/workflows/gradle.yml | 19 +++++-------------- .github/workflows/groovy-joint-workflow.yml | 2 +- .github/workflows/release.yml | 2 +- build.gradle | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 16433fef..32b4cbaa 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -29,30 +29,26 @@ jobs: id: build env: GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew build + run: ./gradlew build --continue publish: name: "Publish Snapshot" if: github.event_name == 'push' needs: build runs-on: ubuntu-24.04 - permissions: - contents: read - packages: read steps: - name: "ðŸ“Ĩ Checkout the repository" uses: actions/checkout@v4 - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: 'liberica' - java-version: '17' + distribution: liberica + java-version: 17 - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "ðŸ“Ī Publish Snapshot to repo.grails.org" env: - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} run: ./gradlew publish @@ -61,25 +57,20 @@ jobs: if: github.event_name == 'push' needs: build runs-on: ubuntu-24.04 - permissions: - contents: read - packages: read steps: - name: "ðŸ“Ĩ Checkout the repository" uses: actions/checkout@v4 - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: 'liberica' - java-version: '17' + distribution: liberica + java-version: 17 - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "ðŸ”Ļ Build Docs" id: docs - env: - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: ./gradlew docs - name: "ðŸ“Ī Publish docs to Github Pages" if: steps.docs.outcome == 'success' diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 45d56bed..37ed0391 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -131,6 +131,6 @@ jobs: env: GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: > - ./gradlew build + ./gradlew build --continue -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 f6a15de9..5108e382 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} run: > - ./gradlew + ./gradlew --no-build-cache -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeSonatypeStagingRepository diff --git a/build.gradle b/build.gradle index 21eed731..f26e54cf 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ subprojects { } if (System.getenv('GITHUB_MAVEN_PASSWORD') && !grailsVersion.endsWith('-SNAPSHOT')) { // Used during the release process to access modules temporarily published to GitHub Packages - System.out.println('Adding Grails Core Repo') + logger.warn("Adding Grails Core Repo to $name") maven { url = 'https://maven.pkg.github.com/grails/grails-core' credentials {