Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and cleanup build and CI workflows #115

Merged
merged 7 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 26 additions & 39 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Java CI
name: "Java CI"
on:
push:
branches:
Expand All @@ -11,52 +11,39 @@ jobs:
build:
runs-on: ubuntu-latest
env:
WORKSPACE: ${{ github.workspace }}
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
GIT_USER_NAME: grails-build
GIT_USER_EMAIL: grails-build@users.noreply.github.com
steps:
- uses: actions/checkout@v4
- name: Set up JDK
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Run Build
uses: gradle/gradle-build-action@v3
distribution: temurin
java-version: 11
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
- name: "🔨 Run Build"
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 }}
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: '11'
- name: Publish Artifacts (repo.grails.org)
id: publish
uses: gradle/gradle-build-action@v3
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: ./gradlew build
- name: "📤 Publish Snapshot to repo.grails.org"
if: success() && github.event_name == 'push'
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 }}
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
with:
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
- name: Publish to Github Pages
if: success()
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: >
./gradlew
-Dorg.gradle.internal.publish.checksums.insecure=true
publish
- name: "📖 Publish Groovydoc to Github Pages"
if: success() && github.event_name == 'push'
uses: micronaut-projects/github-pages-deploy-action@grails
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BRANCH: gh-pages
FOLDER: build/docs
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }}
COMMIT_NAME: ${{ env.GIT_USER_NAME }}
DOC_FOLDER: gh-pages
COMMIT_EMAIL: behlp@objectcomputing.com
COMMIT_NAME: Puneet Behl
FOLDER: build/docs
GH_TOKEN: ${{ secrets.GH_TOKEN }}
37 changes: 3 additions & 34 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Changelog
name: "Changelog"
on:
issues:
types: [closed,reopened]
Expand All @@ -11,38 +11,7 @@ jobs:
release_notes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Check if it has release drafter config file
id: check_release_drafter
run: |
has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false")
echo ::set-output name=has_release_drafter::${has_release_drafter}
- name: Extract branch name
id: extract_branch
run: echo ::set-output name=value::${GITHUB_REF:11}
# If it has release drafter:
- uses: release-drafter/release-drafter@v6
if: steps.check_release_drafter.outputs.has_release_drafter == 'true'
- name: "📝 Update release notes draft"
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
commitish: ${{ steps.extract_branch.outputs.value }}
# Otherwise:
- name: Export Gradle Properties
if: steps.check_release_drafter.outputs.has_release_drafter == 'false'
uses: micronaut-projects/github-actions/export-gradle-properties@master
- uses: micronaut-projects/github-actions/release-notes@master
if: steps.check_release_drafter.outputs.has_release_drafter == 'false'
id: release_notes
with:
token: ${{ secrets.GH_TOKEN }}
- uses: ncipollo/release-action@v1
if: steps.check_release_drafter.outputs.has_release_drafter == 'false' && steps.release_notes.outputs.generated_changelog == 'true'
with:
allowUpdates: true
commit: ${{ steps.release_notes.outputs.current_branch }}
draft: true
name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }}
tag: v${{ steps.release_notes.outputs.next_version }}
bodyFile: CHANGELOG.md
token: ${{ secrets.GH_TOKEN }}
70 changes: 30 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,57 @@
name: Release
name: "Release"
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['11']
env:
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: behlp@objectcomputing.com
GIT_USER_NAME: grails-build
GIT_USER_EMAIL: grails-build@users.noreply.github.com
steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up JDK
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Set the current release version
distribution: temurin
java-version: 11
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
- name: "🔢 Set the current release version"
id: release_version
run: echo ::set-output name=release_version::${GITHUB_REF:11}
- name: Run pre-release
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
- name: "⚙️ Run pre-release"
uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate secring file
- 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
- name: "📤 Publish to Sonatype"
id: publish
uses: gradle/gradle-build-action@v3
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
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 }}
with:
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Run Assemble
run: >
./gradlew
-Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg
publishToSonatype
closeAndReleaseSonatypeStagingRepository
- name: "📦 Run Assemble"
id: assemble
if: steps.publish.outcome == 'success'
uses: gradle/gradle-build-action@v3
with:
arguments: assemble
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 }}
- name: Export Gradle Properties
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: ./gradlew assemble
- name: "✈️ Export Gradle Properties"
uses: micronaut-projects/github-actions/export-gradle-properties@master
- name: Publish to Github Pages
- name: "📖 Publish Groovydoc to Github Pages"
if: steps.assemble.outcome == 'success'
uses: micronaut-projects/github-pages-deploy-action@master
env:
Expand All @@ -67,13 +61,9 @@ jobs:
BRANCH: gh-pages
FOLDER: build/docs
DOC_FOLDER: gh-pages
COMMIT_EMAIL: behlp@objectcomputing.com
COMMIT_NAME: Puneet Behl
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }}
COMMIT_NAME: ${{ env.GIT_USER_NAME }}
VERSION: ${{ steps.release_version.outputs.release_version }}
- name: Run post-release
- name: "⚙️ Run post-release"
if: success()
uses: micronaut-projects/github-actions/post-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
env:
SNAPSHOT_SUFFIX: -SNAPSHOT
uses: micronaut-projects/github-actions/post-release@master
28 changes: 13 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'org.grails.grails-plugin'
id 'org.grails.grails-gsp'
id 'org.grails.internal.grails-plugin-publish'
}

version project.projectVersion
group "org.grails.plugins"
version = project.projectVersion
group = 'org.grails.plugins'

repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url = 'https://repo.grails.org/grails/core' }
}

sourceCompatibility = 1.11
targetCompatibility = 1.11
java {
sourceCompatibility = JavaVersion.VERSION_11
}

dependencyManagement {
imports {
Expand All @@ -25,22 +24,21 @@ dependencyManagement {
}

dependencies {
api "org.grails:grails-dependencies"
api "org.grails:grails-web-boot"
api 'org.grails:grails-dependencies'
api 'org.grails:grails-web-boot'

api "io.github.gpc:fields:$fieldsVersion"

console "org.grails:grails-console"
console 'org.grails:grails-console'
}


grailsPublish {
userOrg = "grails"
userOrg = 'grails'
githubSlug = 'grails/scaffolding'
license {
name = 'Apache-2.0'
}
title = "Grails Scaffolding Plugin"
desc = "Provides scaffolding for Grails applications"
developers = [puneetbehl: "Puneet Behl"]
title = 'Grails Scaffolding Plugin'
desc = 'Provides scaffolding for Grails applications'
developers = [puneetbehl: 'Puneet Behl']
}
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
implementation("org.grails:grails-gradle-plugin:6.1.1")
runtimeOnly 'org.grails:grails-gradle-plugin:6.1.1'
}
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ fieldsVersion=5.0.3

org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1536M -XX:MaxMetaspaceSize=512M
org.gradle.parallel=true
39 changes: 14 additions & 25 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}

plugins {
id "com.gradle.enterprise" version "3.17.1"
id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13'
id 'com.gradle.develocity' version '3.18'
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 {
publishAlways()
publishIfAuthenticated()
uploadInBackground = System.getenv("CI") == null
capture {
taskInputFiles = true
}
publishing.onlyIf { isAuthenticated }
uploadInBackground = isLocal
}
}

buildCache {
local { enabled = System.getenv('CI') != 'true' }
remote(HttpBuildCache) {
push = System.getenv('CI') == 'true'
local { enabled = isLocal }
remote(develocity.buildCache) {
push = isCI && isAuthenticated
enabled = true
url = 'https://ge.grails.org/cache/'
credentials {
username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')
password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')
}
}}
}
}

rootProject.name='scaffolding'