Merge pull request #13942 from jdaugherty/7.0.x #4500
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
name: "Java CI" | |
on: | |
push: | |
branches: | |
- '[4-9]+.[0-9]+.x' | |
- '[3-9]+.[3-9]+.x' | |
pull_request: | |
branches: | |
- '[4-9]+.[0-9]+.x' | |
- '[3-9]+.[3-9]+.x' | |
workflow_dispatch: | |
jobs: | |
skip_check: | |
runs-on: ubuntu-latest | |
outputs: | |
found_skip_publish: ${{ steps.check_prevent_property.outputs.value }} | |
permissions: | |
contents: read | |
steps: | |
- name: "π₯ Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "π Check if we should skip publish" | |
id: check_prevent_property | |
run: | | |
if grep -q '^preventSnapshotPublish=true' gradle.properties; then | |
echo "value=true" >> $GITHUB_OUTPUT | |
else | |
echo "value=false" >> $GITHUB_OUTPUT | |
fi | |
build: | |
needs: skip_check | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
strategy: | |
matrix: | |
java: [17, 21, 23] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "π₯ Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "βοΈ Setup JDK" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: liberica | |
java-version: ${{ matrix.java }} | |
- name: "π Setup Gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
- name: "π¨ Build project" | |
id: 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 assemble groovydoc | |
publish: | |
if: github.event_name == 'push' && needs.skip_check.outputs.found_skip_publish != 'true' | |
needs: build | |
permissions: | |
contents: read # limit to read access | |
runs-on: ubuntu-latest | |
steps: | |
- 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.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
- name: "π€ Publish Snapshot Artifacts to Artifactory (repo.grails.org/libs-snapshot-local)" | |
id: publish | |
env: | |
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
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 | |
docs: | |
if: github.event_name == 'push' && needs.skip_check.outputs.found_skip_publish != 'true' | |
needs: publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read # limit to read access | |
steps: | |
- name: "π Store the target branch" | |
id: extract_branch | |
run: | | |
echo "Determining Target Branch" | |
TARGET_BRANCH=${GITHUB_REF#refs/heads/} | |
echo $TARGET_BRANCH | |
echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT | |
- name: "π‘ Invoke the grails-doc release workflow" | |
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) | |
with: | |
workflow: Java CI | |
repo: grails/grails-doc | |
ref: ${{ steps.extract_branch.outputs.value }} | |
token: ${{ secrets.GH_TOKEN }} | |
invoke-third-party-workflows: | |
if: github.event_name == 'push' | |
needs: [build, publish] | |
permissions: | |
contents: read # limit to read access | |
runs-on: ubuntu-latest | |
steps: | |
- name: "π Store the target branch" | |
id: extract_branch | |
run: | | |
echo "Determining Target Branch" | |
TARGET_BRANCH=${GITHUB_REF#refs/heads/} | |
echo $TARGET_BRANCH | |
echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT | |
- name: "π Create Snapshot Message for the Workflow Dispatch" | |
id: dispatch_message | |
run: echo "value={\"message\":\"New Core Snapshot $(date) - $GITHUB_SHA\"}" >> $GITHUB_OUTPUT | |
- name: "π‘ Invoke the Java CI workflow in Grails Functional Tests" | |
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) | |
with: | |
workflow: Java CI | |
repo: grails/grails-functional-tests | |
ref: ${{ steps.extract_branch.outputs.value }} | |
token: ${{ secrets.GH_TOKEN }} | |
inputs: ${{ steps.dispatch_message.outputs.value }} |