[workflow_dispatch][3.x] #3043
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 Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: CI Coherence Spring | |
run-name: ${{ github.event.head_commit.message }} [${{ github.event_name }}][${{ github.ref_name }}] | |
on: | |
push: | |
branches: | |
- master | |
- '[1-9]+.x' | |
workflow_dispatch: | |
jobs: | |
build: | |
if: github.repository_owner == 'coherence-community' | |
strategy: | |
matrix: | |
java-version: [ 11, 17, 21 ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up JDK ${{ matrix.java-version }} | |
uses: actions/[email protected] | |
with: | |
distribution: 'adopt' | |
java-version: ${{ matrix.java-version }} | |
- name: Cache SonarCloud packages | |
if: "matrix.java-version == 17" | |
uses: actions/cache@v1 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven2- | |
- name: Build and test with Maven + Sonar | |
if: "github.event_name != 'pull_request' && matrix.java-version == 17" | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
./mvnw clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=coherence-community_coherence-spring -Dsonar.branch.name=${{ env.GITHUB_REF_NAME }} -B -Pspring -Powasp -DautoUpdate=true -Pspring-repo -Pcoverage --settings .mvn/settings.xml | |
env: | |
MAVEN_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" | |
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" | |
SONAR_TOKEN: "${{secrets.SONAR_TOKEN}}" | |
MAVEN_SONATYPE_USERNAME: "${{secrets.MAVEN_SONATYPE_USERNAME}}" | |
MAVEN_SONATYPE_TOKEN: "${{secrets.MAVEN_SONATYPE_TOKEN}}" | |
NVD_API_KEY: "${{secrets.NVD_API_KEY}}" | |
- name: Build and test with Maven - ${{ matrix.java-version }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
./mvnw clean install -B -Pspring -Powasp,jdk${{ matrix.java-version }} -DautoUpdate=true --settings .mvn/settings.xml | |
env: | |
GIT_COMMIT: ${{github.event.workflow_run.head_commit.id}} | |
HEAD_BRANCH: ${{github.event.workflow_run.head_branch}} | |
MAVEN_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" | |
MAVEN_SONATYPE_USERNAME: "${{secrets.MAVEN_SONATYPE_USERNAME}}" | |
MAVEN_SONATYPE_TOKEN: "${{secrets.MAVEN_SONATYPE_TOKEN}}" | |
NVD_API_KEY: "${{secrets.NVD_API_KEY}}" | |
- name: Deploy Snapshots | |
if: "github.event_name != 'pull_request' && matrix.java-version == 11" | |
env: | |
MAVEN_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" | |
MAVEN_SONATYPE_USERNAME: "${{secrets.MAVEN_SONATYPE_USERNAME}}" | |
MAVEN_SONATYPE_TOKEN: "${{secrets.MAVEN_SONATYPE_TOKEN}}" | |
NVD_API_KEY: "${{secrets.NVD_API_KEY}}" | |
run: ./mvnw deploy -B -Pspring --settings .mvn/settings.xml | |
- name: Clean Maven cache | |
run: | | |
find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr |