From c4b852957d2c50ede14db6392b3da5375f8b4a8e Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sat, 28 Aug 2021 14:28:28 +0200 Subject: [PATCH] init commit --- .github/workflows/test.yml | 31 ++++++++++++++++ LICENSE | 22 ++++++++++++ README.md | 73 ++++++++++++++++++++++++++++++++++++++ action.yml | 72 +++++++++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 action.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7d75178 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..51138b3 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f850f78 --- /dev/null +++ b/README.md @@ -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) diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..8845b84 --- /dev/null +++ b/action.yml @@ -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