23 Commits

Author SHA1 Message Date
d27f7bad34 Merge pull request #13 from s4u/s-j-2.3.1
Bump setup-java from 2.3.0 to 2.3.1
2021-10-09 13:25:42 +02:00
07db3fb4b2 Bump setup-java from 2.3.0 to 2.3.1
https://github.com/actions/setup-java/releases/tag/v2.3.1
2021-10-09 13:21:38 +02:00
3a36aae9ec Merge pull request #12 from s4u/jdk-17
Replace jdk 16 by 17 in tests
2021-10-09 13:19:15 +02:00
b8af8b0ed8 Replace jdk 16 by 17 in tests 2021-10-09 13:09:19 +02:00
336767f6a6 Merge pull request #11 from s4u/s-m-4.2
Bump setup-maven from 4.1 to 4.2
2021-10-09 12:57:07 +02:00
078175723e Bump setup-maven from 4.1 to 4.2
https://github.com/stCarolas/setup-maven/releases/tag/v4.2
2021-10-09 12:51:25 +02:00
38506fd243 Merge pull request #10 from s4u/mvn-3.8.3
Maven 3.8.3 as default
2021-10-07 08:36:45 +02:00
41d4657217 Maven 3.8.3 as default 2021-10-06 23:49:55 +02:00
e9a7bdc6d6 Merge pull request #9 from s4u/rm-debug
Remove group / debug info
2021-10-06 22:39:10 +02:00
b3d576e79a Remove group / debug info 2021-10-06 22:33:58 +02:00
ff43cac4ad Merge pull request #7 from s4u/action-name
Simplify action name
2021-08-30 19:49:36 +02:00
cac57cc0b0 Simplify action name 2021-08-30 19:44:30 +02:00
490f541598 Merge pull request #5 from s4u/checkout
Use actions/checkout
2021-08-30 08:37:39 +02:00
638a374dff Use actions/checkout 2021-08-30 08:33:27 +02:00
6f35cfffb0 Merge pull request #3 from s4u/concurrency
concurrency mode for tests build
2021-08-29 22:50:24 +02:00
4ce3c6745c concurrency mode for tests build 2021-08-29 22:04:21 +02:00
2261292f40 File sync from s4u/.github - include main branch in builds 2021-08-29 19:49:52 +00:00
10041ccdff File sync from s4u/.github - Use Tech Token for Auto Approve 2021-08-29 19:39:29 +00:00
7d14bd0fab Merge pull request #2 from s4u/cache
Use actions/cache
2021-08-29 17:04:57 +02:00
73706c9355 Use actions/cache 2021-08-29 16:53:38 +02:00
f625f4e949 File sync from s4u/.github - Auto merge patch and minor updates 2021-08-28 21:42:38 +00:00
d253165ff8 File sync from s4u/.github - Auto Approve by gh cli 2021-08-28 21:32:26 +00:00
339d84e602 fix action name in example 2021-08-28 22:47:51 +02:00
5 changed files with 125 additions and 42 deletions

View File

@ -1,4 +1,4 @@
name: Auto approve name: Auto Approve
on: on:
pull_request_target pull_request_target
@ -8,18 +8,27 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: alexwilson/enable-github-automerge-action@1.0.0 - name: Dependabot metadata
if: > if: github.actor == 'dependabot[bot]'
github.actor == 'dependabot[bot]' id: dependabot-metadata
|| github.actor == 'dependabot-preview[bot]' uses: dependabot/fetch-metadata@v1.1.1
with: with:
merge-method: "REBASE"
github-token: "${{ secrets.TECH_TOKEN }}" github-token: "${{ secrets.TECH_TOKEN }}"
- uses: hmarr/auto-approve-action@v2.1.0 - name: Enable auto-merge for Dependabot PRs
if: >
github.actor == 'dependabot[bot]'
&& steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.TECH_TOKEN }}
- name: Approve a PR
if: > if: >
github.actor == 'dependabot[bot]' github.actor == 'dependabot[bot]'
|| github.actor == 'dependabot-preview[bot]'
|| github.actor == 'slawekjaranowski' || github.actor == 'slawekjaranowski'
with: run: gh pr review --approve "$PR_URL"
github-token: "${{ secrets.TECH_TOKEN }}" env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.TECH_TOKEN }}

View File

@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- 'master' - 'master'
- 'main'
jobs: jobs:
update_release_draft: update_release_draft:

View File

@ -2,13 +2,19 @@ name: Test
on: on:
pull_request: pull_request:
branches:
- 'main'
push: push:
branches-ignore: branches:
- 'dependabot/**' - 'main'
schedule: schedule:
- cron: '22 23 * * 5' - cron: '22 23 * * 5'
concurrency:
group: test-action-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
test: test:
name: Test name: Test
@ -16,8 +22,8 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ] os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
java: [ '8', '11', '16' ] java: [ '8', '11', '17' ]
maven: [ '3.5.4', '3.6.3', '3.8.2' ] maven: [ '3.5.4', '3.6.3', '3.8.3' ]
fail-fast: false fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -28,9 +34,29 @@ jobs:
- uses: ./ - uses: ./
with: with:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
java-cache: maven
maven-version: ${{ matrix.maven }} maven-version: ${{ matrix.maven }}
cache-prefix: 'test-prefix-'
- run: mvn -V validate -Drequire.java=${{ matrix.java }} -Drequire.maven=${{ matrix.maven }} - run: mvn -V validate -Drequire.java=${{ matrix.java }} -Drequire.maven=${{ matrix.maven }}
shell: bash shell: bash
test-deault:
name: Test with defaults
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: ./
with:
java-version: 8
- run: mvn -V validate -Drequire.java=8 -Drequire.maven=3.8.3
shell: bash
test-ok:
name: Test OK
runs-on: ubuntu-latest
needs: [ test, test-deault ]
steps:
- run: echo OK

View File

@ -1,18 +1,22 @@
# Setup Maven with settings.xml # Setup Maven Action
[![Test](https://github.com/s4u/setup-maven-action/actions/workflows/test.yml/badge.svg)](https://github.com/s4u/setup-maven-action/actions/workflows/test.yml) [![Test](https://github.com/s4u/setup-maven-action/actions/workflows/test.yml/badge.svg)](https://github.com/s4u/setup-maven-action/actions/workflows/test.yml)
This is composite action which help to prepare GitHub Actions environment for Maven build by calling: This is composite action which help to prepare GitHub Actions environment for Maven build by calling:
- [actions/checkout](https://github.com/marketplace/actions/checkout)
- [actions/setup-java](https://github.com/marketplace/actions/setup-java-jdk) - [actions/setup-java](https://github.com/marketplace/actions/setup-java-jdk)
- [actions/cache](https://github.com/marketplace/actions/cache)
- [stCarolas/setup-maven](https://github.com/marketplace/actions/setup-maven) - [stCarolas/setup-maven](https://github.com/marketplace/actions/setup-maven)
- [s4u/maven-settings-action](https://github.com/marketplace/actions/maven-settings-action) - [s4u/maven-settings-action](https://github.com/marketplace/actions/maven-settings-action)
# Contributions # Contributions
- Contributions are welcome! - Contributions are welcome!
- Give :star: - if you want to encourage me to work on a project - 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 - Don't hesitate to create issues for new features you dream of or if you suspect some bug
# Project versioning # Project versioning
This project uses [Semantic Versioning](https://semver.org/). This project uses [Semantic Versioning](https://semver.org/).
We recommended to use the latest and specific release version. We recommended to use the latest and specific release version.
@ -21,19 +25,48 @@ or use automatic tools like [Dependabot](https://docs.github.com/en/code-securit
# Params mapping for sub actions # Params mapping for sub actions
## checkout
| params | destination |
| -------------------------- |------------------ |
| checkout-fetch-depth | fetch-depth |
## setup-java ## setup-java
| params | destination | default | | params | destination | default |
| ----------------- |------------- |-------- | | ----------------- |------------- |-------- |
| java-version | java-version | | | java-version | java-version | |
| java-distribution | distribution | temurin | | java-distribution | distribution | temurin |
| java-cache | cache | |
## cache
A cache action is configured as:
```yaml
- uses: actions/cache
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 }}-
```
So we can use for action:
| params | description |
| ----------------- |--------------------------------------------------------- |
| cache-path | default cache path for Maven with value ~/.m2/repository |
| cache-path-add | additional value for cache path |
| cache-prefix | prefix value for `key` and `restore-keys` cache params |
## setup-maven ## setup-maven
| params | destination | default | | params | destination | default |
| ------------- |-------------- |-------- | | ------------- |-------------- |-------- |
| maven-version | maven-version | 3.8.1 | | maven-version | maven-version | 3.8.3 |
## maven-settings-action ## maven-settings-action
@ -59,13 +92,13 @@ jobs:
name: Maven ${{ matrix.maven }} sample name: Maven ${{ matrix.maven }} sample
steps: steps:
- uses: actions/checkout@v2
- name: Setup Maven - name: Setup Maven Action
uses: setup-maven@v1.0.0 uses: s4u/setup-maven-action@< version >
with: with:
java-version: 8 java-version: 8
maven-version: ${{ matrix.maven }} maven-version: ${{ matrix.maven }}
- run: mvn -V ... - run: mvn -V ...
``` ```

View File

@ -1,5 +1,5 @@
name: 'Setup Maven with settings.xml' name: 'Setup Maven Action'
description: 'Setup environment for Maven build' description: 'Complete environment configuration for Maven builds'
branding: branding:
icon: 'settings' icon: 'settings'
@ -7,6 +7,11 @@ branding:
inputs: inputs:
# checkout
checkout-fetch-depth:
description: 'Number of commits to fetch'
required: false
# java jdk params # java jdk params
java-version: java-version:
@ -18,14 +23,24 @@ inputs:
default: 'temurin' default: 'temurin'
required: false required: false
java-cache: # cache
description: 'Name of the build platform to cache dependencies. It should be "maven" or empty.' cache-prefix:
required: true 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
maven-version: maven-version:
description: 'The Maven version to set up' description: 'The Maven version to set up'
default: 3.8.1 default: '3.8.3'
required: false required: false
# maven settings.xml # maven settings.xml
@ -50,32 +65,31 @@ runs:
steps: steps:
- run: echo "::group::Setup Java" - uses: actions/checkout@v2.3.4
shell: bash with:
- uses: actions/setup-java@v2.3.0 fetch-depth: '${{ inputs.checkout-fetch-depth }}'
- uses: actions/setup-java@v2.3.1
with: with:
overwrite-settings: false overwrite-settings: false
java-version: '${{ inputs.java-version }}' java-version: '${{ inputs.java-version }}'
distribution: '${{ inputs.java-distribution }}' distribution: '${{ inputs.java-distribution }}'
cache: '${{ inputs.java-cache }}'
- run: echo "::endgroup::"
shell: bash
- run: echo "::group::Setup Maven Version" - uses: actions/cache@v2.1.6
shell: bash with:
- uses: stCarolas/setup-maven@v4.1 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 }}-
- uses: stCarolas/setup-maven@v4.2
with: with:
maven-version: '${{ inputs.maven-version }}' 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 - uses: s4u/maven-settings-action@v2.4.1
with: with:
servers: '${{ inputs.settings-servers}}' servers: '${{ inputs.settings-servers}}'
mirrors: '${{ inputs.settings-mirrors}}' mirrors: '${{ inputs.settings-mirrors}}'
properties: '${{ inputs.settings-properties}}' properties: '${{ inputs.settings-properties}}'
sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots}}' sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots}}'
- run: echo "::endgroup::"
shell: bash