init commit

This commit is contained in:
Slawomir Jaranowski
2021-08-28 14:28:28 +02:00
commit c4b852957d
4 changed files with 198 additions and 0 deletions

31
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Test
on:
pull_request:
push:
branches-ignore:
- 'dependabot/**'
schedule:
- cron: '22 23 * * 5'
jobs:
test:
name: Test
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
java: [ '1.8', '11', '16' ]
maven: [ '3.5.4', '3.6.3', '3.8.2' ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
uses: ./
with:
java-version: ${{ matrix.java }}
maven-version: ${{ matrix.maven }}
run: mvn -v

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2019 Slawomir Jaranowski and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

73
README.md Normal file
View File

@ -0,0 +1,73 @@
# Setup Maven with settings.xml
This is composite action which help to prepare GitHub Actions environment for Maven build by calling:
- [actions/setup-java](https://github.com/marketplace/actions/setup-java-jdk)
- [stCarolas/setup-maven](https://github.com/marketplace/actions/setup-maven)
- [s4u/maven-settings-action](https://github.com/marketplace/actions/maven-settings-action)
# Contributions
- Contributions are welcome!
- Give :star: - if you want to encourage me to work on a project
- Don't hesitate to create issues for new features you dream of or if you suspect some bug
# Project versioning
This project uses [Semantic Versioning](https://semver.org/).
We recommended to use the latest and specific release version.
In order to keep your project dependencies up to date you can watch this repository *(Releases only)*
or use automatic tools like [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates).
# Params mapping for sub actions
## setup-java
| params | destination | default |
| ----------------- |------------- |-------- |
| java-version | java-version | |
| java-distribution | distribution | temurin |
| java-cache | cache | |
## setup-maven
| params | destination | default |
| ------------- |-------------- |-------- |
| maven-version | maven-version | 3.8.1 |
## maven-settings-action
| params | destination |
| -------------------------- |------------------ |
| settings-servers | servers |
| settings-mirrors | mirrors |
| settings-properties | properties |
| settings-sonatypeSnapshots | sonatypeSnapshots |
# Testing against different Maven versions
```yaml
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
maven: [ '3.5.4', '3.6.3', '3.8.2' ]
name: Maven ${{ matrix.maven }} sample
steps:
- uses: actions/checkout@v2
- name: Setup Maven
uses: setup-maven@v1.0.0
with:
java-version: 8
maven-version: ${{ matrix.maven }}
- run: mvn -V ...
```
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)

72
action.yml Normal file
View File

@ -0,0 +1,72 @@
name: 'Setup Maven with settings.xml'
description: 'Setup environment for Maven build'
inputs:
# java jdk params
java-version:
description: 'The Java version to set up'
required: true
java-distribution:
description: 'Java distribution'
default: 'temurin'
required: false
# maven version
maven-version:
description: 'The Maven version to set up'
default: 3.8.1
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:
- run: echo "::group::Setup Java"
shell: bash
- uses: actions/setup-java@v2.3.0
with:
overwrite-settings: false
java-version: '${{ inputs.java-version }}'
distribution: '${{ inputs.java-distribution }}'
- run: echo "::endgroup::"
shell: bash
- run: echo "::group::Setup Maven Version"
shell: bash
- uses: stCarolas/setup-maven@v4.1
with:
maven-version: '${{ inputs.maven-version }}'
- run: echo "::endgroup::"
shell: bash
- run: echo "::group::Prepare Maven settings.xml"
shell: bash
- uses: s4u/maven-settings-action@v2.4.1
with:
servers: '${{ inputs.settings-servers}}'
mirrors: '${{ inputs.settings-mirrors}}'
properties: '${{ inputs.settings-properties}}'
sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots}}'
- run: echo "::endgroup::"
shell: bash