SRU2024 v10 #103
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
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "main", "SRU2024_v10" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ${{ github.ref == 'refs/heads/SRU2024_v10' && 'Set up JDK 11' || 'Set up JDK 8' }} | |
uses: actions/setup-java@v4 | |
with: | |
# Set the JDK version to use for the build depending on the branch | |
java-version: ${{ github.ref == 'refs/heads/SRU2024_v10' && '11' || '8' }} | |
distribution: 'temurin' | |
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | |
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build with Gradle Wrapper | |
run: ./gradlew build | |
# This job generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. | |
# We only do it for the SRU2024_v10 branch to avoid spamming the Dependabot alerts for the legacy Java 8 code. | |
dependency-submission: | |
if: github.ref == 'refs/heads/SRU2024_v10' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. | |
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md | |
- name: Generate and submit dependency graph | |
uses: gradle/actions/dependency-submission@v4 | |
with: | |
dependency-graph-exclude-projects: ':buildSrc' |