From dc0270b4d11ef8526825313ac071bd1bc4270c1f Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 8 Dec 2023 01:07:40 +0530 Subject: [PATCH] Update gradle.yml (#397) - Breakdown into multiple jobs - Use actions/uploadArtifact to upload artifacts --- .github/workflows/gradle.yml | 59 +++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 7a75a4ddad..3035ca2363 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -2,21 +2,21 @@ 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 @@ -24,14 +24,7 @@ jobs: 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: @@ -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 }} @@ -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 @@ -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 \ No newline at end of file