mirror of
https://github.com/s4u/setup-maven-action.git
synced 2026-02-16 00:00:14 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 490f541598 | |||
| 638a374dff | |||
| 6f35cfffb0 | |||
| 4ce3c6745c | |||
| 2261292f40 | |||
| 10041ccdff | |||
| 7d14bd0fab | |||
| 73706c9355 | |||
| f625f4e949 | |||
| d253165ff8 | |||
| 339d84e602 |
29
.github/workflows/auto-approve.yml
vendored
29
.github/workflows/auto-approve.yml
vendored
@ -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 }}
|
||||||
|
|||||||
1
.github/workflows/release-drafter.yml
vendored
1
.github/workflows/release-drafter.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
|
- 'main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update_release_draft:
|
update_release_draft:
|
||||||
|
|||||||
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@ -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
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
@ -28,8 +34,8 @@ 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
|
||||||
|
|||||||
41
README.md
41
README.md
@ -3,16 +3,20 @@
|
|||||||
|
|
||||||
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,13 +25,42 @@ 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
|
||||||
|
|
||||||
@ -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 with settings.xml
|
||||||
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 ...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
44
action.yml
44
action.yml
@ -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.1'
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
# maven settings.xml
|
# maven settings.xml
|
||||||
@ -50,6 +65,14 @@ runs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- run: echo "::group::Checkout"
|
||||||
|
shell: bash
|
||||||
|
- uses: actions/checkout@v2.3.4
|
||||||
|
with:
|
||||||
|
fetch-depth: '${{ inputs.checkout-fetch-depth }}'
|
||||||
|
- run: echo "::endgroup::"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- run: echo "::group::Setup Java"
|
- run: echo "::group::Setup Java"
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: actions/setup-java@v2.3.0
|
- uses: actions/setup-java@v2.3.0
|
||||||
@ -57,7 +80,18 @@ runs:
|
|||||||
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 Cache"
|
||||||
|
shell: bash
|
||||||
|
- uses: actions/cache@v2.1.6
|
||||||
|
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 }}-
|
||||||
- run: echo "::endgroup::"
|
- run: echo "::endgroup::"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user