Configure Gradle Versions Plugin. [skip-ci] #54
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: Build | |
on: | |
push: | |
#pull_request: | |
workflow_dispatch: | |
inputs: | |
additionalGradleOptions: | |
description: 'Additional Gradle options' | |
required: false | |
default: '' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
PUSH_GRADLE_OPTIONS: '' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Restore Sonar Cache | |
uses: actions/cache@v3 | |
if: ${{ github.event_name == 'push' && !startsWith(github.ref_name, 'dependabot/') }} | |
with: | |
path: /home/runner/.sonar/cache | |
key: sonar-cache | |
- name: Set Push Gradle options | |
if: ${{ github.event_name == 'push' && !startsWith(github.ref_name, 'dependabot/') }} | |
run: echo "PUSH_GRADLE_OPTIONS=sonar" >> $GITHUB_ENV | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: '--no-daemon build ${{ env.PUSH_GRADLE_OPTIONS }} ${{ github.event.inputs.additionalGradleOptions }}' | |
cache-read-only: false | |
- name: Upload reports | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: reports | |
path: build/reports | |
- name: Upload libs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libs | |
path: build/libs |