doc: π Adds usage documentation for adding dependency to a Maven project #34
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, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Java CI with Maven | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
name: Build Java project with Maven | |
runs-on: ubuntu-latest | |
steps: | |
# Checks out a copy of project's repository. | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Shallow clones should be disabled for a better relevancy of analysis | |
fetch-depth: 0 | |
# Sets up the Java JDK, and also configures the Maven `settings.xml` file to add authentication for the | |
# `ossrh` repository using the `OSSRH_USERNAME` and `OSSRH_TOKEN` environment variables. | |
- name: Set up Project | |
uses: actions/setup-java@v4 | |
with: | |
java-version-file: '.java-version' | |
distribution: 'temurin' | |
cache: 'maven' | |
cache-dependency-path: 'pom.yml' | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build and analyze | |
env: | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./mvnw --batch-mode verify org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar |