-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and cleanup build and CI workflows (#115)
* build: Update and cleanup build * ci: Update and cleanup Github workflows * chore(build): Cleanup * ci: Add build cache auth env vars
- Loading branch information
Showing
7 changed files
with
104 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Java CI | ||
name: "Java CI" | ||
on: | ||
push: | ||
branches: | ||
|
@@ -11,52 +11,43 @@ 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: [email protected] | ||
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: 'liberica' | ||
java-version: '11' | ||
- name: Run Build | ||
uses: gradle/gradle-build-action@v3 | ||
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 | ||
distribution: liberica | ||
java-version: 11 | ||
- name: "🐘 Setup Gradle" | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
distribution: 'liberica' | ||
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 }} | ||
- name: "🔨 Run Build" | ||
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 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_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 | ||
-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: [email protected] | ||
COMMIT_NAME: Puneet Behl | ||
FOLDER: build/docs | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,61 @@ | ||
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: [email protected].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: 'liberica' | ||
java-version: ${{ matrix.java }} | ||
- name: Set the current release version | ||
distribution: liberica | ||
java-version: 11 | ||
- name: "🐘 Setup Gradle" | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | ||
- 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_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_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_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: "✈️ 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: | ||
|
@@ -67,13 +65,9 @@ jobs: | |
BRANCH: gh-pages | ||
FOLDER: build/docs | ||
DOC_FOLDER: gh-pages | ||
COMMIT_EMAIL: [email protected] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,33 @@ | ||
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.1' | ||
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 | ||
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 { | ||
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 && isBuildCacheAuthenticated | ||
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') | ||
} | ||
}} | ||
usernameAndPassword( | ||
System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: '', | ||
System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: '' | ||
) | ||
} | ||
} | ||
|
||
rootProject.name='scaffolding' |