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 github workflows #58

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
64 changes: 30 additions & 34 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,64 +11,60 @@ env:
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

jobs:

test_project:
name: Test Project
name: "Test Project"
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
java: [17]

java: [17, 21]
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- uses: actions/setup-java@v4
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: ${{ matrix.java }}
- uses: gradle/actions/setup-gradle@v3
- name: Run tests
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "🏃 Run tests"
run: ./gradlew check

publish_snapshot:
name: Build Project and Publish Snapshot release
name: "Build Project and Publish Snapshot release"
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- uses: actions/setup-java@v4
with: { java-version: 17, distribution: temurin }
- uses: gradle/actions/setup-gradle@v3

- name: Build Project
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with: {
java-version: 17,
distribution: liberica
}
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "🔨 Build Project"
run: ./gradlew build

- name: Publish Snapshot version to Artifactory (repo.grails.org)
- name: "📤 Publish Snapshot version to Artifactory (repo.grails.org)"
if: success()
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
ORG_GRADLE_PROJECT_artifactoryPublishUsername: ${{ secrets.ARTIFACTORY_USERNAME }}
ORG_GRADLE_PROJECT_artifactoryPublishPassword: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: >
./gradlew
-Dorg.gradle.internal.publish.checksums.insecure=true
publish

- name: Generate Snapshot Documentation
- name: "📖 Generate Snapshot Documentation"
if: success()
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: ./gradlew docs

- name: Publish Snapshot Documentation to Github Pages
- name: "📤 Publish Snapshot Documentation to Github Pages"
if: success()
uses: micronaut-projects/github-pages-deploy-action@grails
env:
Expand Down
50 changes: 23 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,51 @@
name: Release
name: "Release"
on:
release:
types: [published]
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- uses: actions/setup-java@v4
with: { java-version: 11, distribution: temurin }
- uses: gradle/actions/setup-gradle@v3

- name: Get the current release version
- name: "📥 Checkout 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:
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "📝 Store the current release version"
id: release_version
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT

- name: Run pre-release
- name: "⚙ Run pre-release"
uses: micronaut-projects/github-actions/pre-release@master

- 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 artifacts to Sonatype
- name: "📤 Publish artifacts to Sonatype"
id: publish_to_sonatype
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
run: >
./gradlew
-Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg
publishToSonatype
closeAndReleaseSonatypeStagingRepository

- name: Generate Documentation
- name: "📖 Generate Documentation"
if: success()
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
run: ./gradlew docs

- name: Publish Documentation to Github Pages
- name: "📤 Publish Documentation to Github Pages"
if: success()
uses: micronaut-projects/github-pages-deploy-action@grails
env:
Expand All @@ -60,7 +55,8 @@ jobs:
FOLDER: build/docs/manual
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VERSION: ${{ steps.release_version.outputs.release_version }}

- name: Run post-release
- name: "⚙️ Run post-release"
if: steps.publish_to_sonatype.outcome == 'success'
uses: micronaut-projects/github-actions/post-release@master
uses: micronaut-projects/github-actions/post-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 3 additions & 4 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ext.set('signing.password', findProperty('signing.password') ?: System.getenv('S
def javaComponent = components.named('java')
publishing {
publications {
register('grailsMailPlugin', MavenPublication) {
maven(MavenPublication) {
from javaComponent.get()
versionMapping {
usage('java-api') { fromResolutionOf('runtimeClasspath') }
Expand Down Expand Up @@ -91,14 +91,13 @@ publishing {
}
}

def mavenPublication = extensions.findByType(PublishingExtension).publications.named('grailsMailPlugin')
tasks.withType(Sign).configureEach {
onlyIf { isReleaseVersion }
}
afterEvaluate {
signing {
required = { isReleaseVersion }
sign(mavenPublication.get())
required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') }
sign(publishing.publications.maven)
}
}

Expand Down
16 changes: 9 additions & 7 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
plugins {
id 'com.gradle.develocity' version '3.17.1'
id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0'
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') == 'true'
def isCI = System.getenv('CI') != null
def isLocal = !isCI
def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null

develocity {
server = 'https://ge.grails.org'
buildScan {
publishing.onlyIf { isCI }
uploadInBackground = !isCI
publishing.onlyIf { isAuthenticated }
uploadInBackground = isLocal
}
}

buildCache {
local { enabled = !isCI }
local { enabled = isLocal }
remote(develocity.buildCache) {
push = isCI && isAuthenticated
enabled = true
push = isCI && System.getenv('DEVELOCITY_ACCESS_KEY')
}
}

Expand Down
Loading