Github Action wrapping Maven CLI to run any Maven commands using JDK 8, 11, 13, 14, 15, 16 or 17 based on Maven DockerHub.
Those commands can be executed on the current repository directory, or in a specific one using a $DIRECTORY_PATH environment variable.
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout your repository under $GITHUB_WORKSPACE, so your job can access your directories and files
- uses: actions/checkout@v2
# Runs a set of commands using the runners shell
- name: Run maven commands
uses: GuillaumeFalourd/maven-cli-jdks-action@main # Default is JDK 11
env:
DIRECTORY_PATH: java # Not mandatory (run on the repo root directory if not informed)
with:
commands: 'clean package test'This workflow use a Dockerfile with Maven and a specific JDK installed to execute a Shell script file entrypoint.sh to perfom the following commands:
if [[ -z $DIRECTORY_PATH ]];
then
echo "DIRECTORY_PATH env isn't set. Running in current directory"
else
echo "Moving to specified directory path"
cd $DIRECTORY_PATH
fi
echo "Executing command: mvn $1"
sh -c "mvn $1"uses: GuillaumeFalourd/maven-cli-action@jdk8uses: GuillaumeFalourd/maven-cli-jdks-action@mainuses: GuillaumeFalourd/maven-cli-jdks-action@jdk13uses: GuillaumeFalourd/maven-cli-jdks-action@jdk14uses: GuillaumeFalourd/maven-cli-jdks-action@jdk15uses: GuillaumeFalourd/maven-cli-jdks-action@jdk16uses: GuillaumeFalourd/maven-cli-jdks-action@jdk17This repository uses the Apache License 2.0
