mirror of
http://43.153.184.91:8080/https://github.com/s4u/setup-maven-action.git
synced 2026-01-27 11:13:00 +08:00
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3 to 4. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
137 lines
4.0 KiB
YAML
137 lines
4.0 KiB
YAML
name: 'Setup Maven Action'
|
|
description: 'Complete environment configuration for Maven builds'
|
|
|
|
branding:
|
|
icon: 'settings'
|
|
color: 'green'
|
|
|
|
inputs:
|
|
|
|
# checkout
|
|
checkout-fetch-depth:
|
|
description: 'Number of commits to fetch'
|
|
required: false
|
|
|
|
checkout-path:
|
|
description: 'Relative path under $GITHUB_WORKSPACE to place the repository'
|
|
required: false
|
|
|
|
checkout-persist-credentials:
|
|
description: 'Whether to configure the token or SSH key with the local git config'
|
|
default: 'false'
|
|
required: false
|
|
|
|
checkout-ref:
|
|
description: 'The branch, tag, or SHA of the repository to clone'
|
|
required: false
|
|
|
|
checkout-repository:
|
|
description: 'The repository to checkout if not the repository that triggered the action. For use when building GitHub Apps'
|
|
required: false
|
|
default: ${{ github.repository }}
|
|
|
|
checkout-token:
|
|
description: 'Token to use for checkout if checking out a repository out of scope for GITHUB_TOKEN'
|
|
required: false
|
|
default: ${{ github.token }}
|
|
|
|
# java jdk params
|
|
|
|
java-version:
|
|
description: 'The Java version to set up'
|
|
default: '17'
|
|
required: true
|
|
|
|
java-distribution:
|
|
description: 'Java distribution'
|
|
default: 'temurin'
|
|
required: false
|
|
|
|
# cache
|
|
cache-enabled:
|
|
description: 'Enable cache'
|
|
default: 'true'
|
|
required: false
|
|
|
|
cache-prefix:
|
|
description: 'Cache key prefix'
|
|
required: false
|
|
|
|
cache-path:
|
|
description: 'Cache path'
|
|
default: '~/.m2/repository'
|
|
required: false
|
|
|
|
cache-path-add:
|
|
description: 'Additional item for cache path'
|
|
required: false
|
|
|
|
# maven version
|
|
maven-version:
|
|
description: 'The Maven version to set up'
|
|
default: '3.9.5'
|
|
required: false
|
|
|
|
# maven settings.xml
|
|
settings-servers:
|
|
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
|
required: false
|
|
|
|
settings-mirrors:
|
|
description: 'mirrors definition in json array, eg: [{"id": "id", "name": "name", "mirrorOf": "mirrorOf", "url": "url"}]'
|
|
required: false
|
|
|
|
settings-properties:
|
|
description: 'json array with properties, eg [{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
|
required: false
|
|
|
|
settings-sonatypeSnapshots:
|
|
description: 'add https://oss.sonatype.org/content/repositories/snapshots to repository list - true or false'
|
|
required: false
|
|
|
|
runs:
|
|
using: 'composite'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: '${{ inputs.checkout-fetch-depth }}'
|
|
path: '${{ inputs.checkout-path }}'
|
|
persist-credentials: '${{ inputs.checkout-persist-credentials }}'
|
|
ref: '${{ inputs.checkout-ref }}'
|
|
repository: '${{ inputs.checkout-repository }}'
|
|
token: '${{ inputs.checkout-token }}'
|
|
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
overwrite-settings: false
|
|
java-version: '${{ inputs.java-version }}'
|
|
distribution: '${{ inputs.java-distribution }}'
|
|
|
|
- uses: actions/cache@v3
|
|
if: inputs.cache-enabled == 'true'
|
|
with:
|
|
path: |
|
|
${{ inputs.cache-path }}
|
|
${{ inputs.cache-path-add }}
|
|
key: ${{ inputs.cache-prefix }}${{ runner.os }}-jdk${{ inputs.java-version }}-${{ inputs.java-distribution }}-maven${{ inputs.maven-version }}-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ inputs.cache-prefix }}${{ runner.os }}-jdk${{ inputs.java-version }}-${{ inputs.java-distribution }}-maven${{ inputs.maven-version }}-
|
|
|
|
- name: Installed Maven version
|
|
run: echo "version=$(mvn -q -v)" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
id: current-maven
|
|
|
|
- uses: stCarolas/setup-maven@v4.5
|
|
if: inputs.maven-version != steps.current-maven.outputs.version
|
|
with:
|
|
maven-version: '${{ inputs.maven-version }}'
|
|
|
|
- uses: s4u/maven-settings-action@v2.8.0
|
|
with:
|
|
servers: '${{ inputs.settings-servers}}'
|
|
mirrors: '${{ inputs.settings-mirrors}}'
|
|
properties: '${{ inputs.settings-properties}}'
|
|
sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots}}'
|