Skip to content

Commit

Permalink
Update gradle.yml (#397)
Browse files Browse the repository at this point in the history
- Breakdown into multiple jobs
- Use actions/uploadArtifact to upload artifacts
  • Loading branch information
puneetbehl authored Dec 7, 2023
1 parent ed2c76b commit dc0270b
Showing 1 changed file with 38 additions and 21 deletions.
59 changes: 38 additions & 21 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,29 @@ name: Java CI
on:
push:
branches:
- master
- '[3-9]+.[0-9]+.x'
pull_request:
branches:
- master
- '[3-9]+.[0-9]+.x'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
java: ['11', '14', '17']
env:
WORKSPACE: ${{ github.workspace }}
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Run Tests
if: github.event_name == 'pull_request'
id: tests
uses: gradle/gradle-build-action@v2
with:
arguments: check
- name: Run Build
if: github.event_name == 'push'
id: build
uses: gradle/gradle-build-action@v2
env:
Expand All @@ -40,8 +33,26 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build
- name: Upload Artifacts
if: steps.build.outcome == 'success' && matrix.java == '11'
uses: actions/upload-artifact@v3
with:
name: grails-gsp.zip
path: build/libs/grails-gsp-*.zip
publish:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Publish to repo.grails.org
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11'
uses: gradle/gradle-build-action@v2
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
Expand All @@ -51,15 +62,21 @@ jobs:
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
with:
arguments: publish
- name: Publish Test Report
if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure'
uses: scacap/action-surefire-report@v1
docs:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/test/TEST-*.xml'
distribution: 'adopt'
java-version: '11'
- name: Build Docs
id: docs
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11'
uses: gradle/gradle-build-action@v2
with:
arguments: docs
Expand All @@ -68,12 +85,12 @@ jobs:
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: Publish to Github Pages
if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '11'
uses: micronaut-projects/github-pages-deploy-action@master
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: build/docs
COMMIT_EMAIL: behlp@objectcomputing.com
COMMIT_NAME: Puneet Behl
COMMIT_EMAIL: behlp@unityfoundation.io
COMMIT_NAME: Puneet Behl

0 comments on commit dc0270b

Please sign in to comment.