mirror of
https://github.com/s4u/setup-maven-action.git
synced 2026-02-13 00:05:10 +08:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a37cecafbf | |||
| a4199cab67 | |||
| 787523041c | |||
| 4aedd0b3b2 | |||
| 5f52556e27 | |||
| 5eec3f78f3 | |||
| 4095a894c5 | |||
| 8a09fe4cf2 | |||
| 2b1e091324 | |||
| 2059bfe2f2 | |||
| 6e3103c027 | |||
| 2f53a7669c | |||
| 1bea7e41c5 | |||
| 816f5e6ba8 | |||
| 25553285e3 | |||
| 4894416432 | |||
| a9992a1ccd | |||
| 3b45b50cd5 | |||
| 5a52b9da46 | |||
| e2f38a4518 | |||
| 9d09e3987e | |||
| f480a422c2 | |||
| 6d44c18d67 | |||
| 9f3d803b4e | |||
| 023b47f3ae | |||
| 5257c30aee | |||
| 88b5bc7548 | |||
| 6c5362973d | |||
| f8353fecf3 | |||
| 9337884575 | |||
| c6cceea941 | |||
| fa2c7e4517 | |||
| 78d72295d8 | |||
| 5727e29093 | |||
| 57ca7f1a81 | |||
| 41e894b5c6 | |||
| c1ef1c9458 | |||
| fe0723070c | |||
| f416ae1666 | |||
| 428a7bd6a8 | |||
| 7b66d0ca2e | |||
| 2dce5ee2b1 | |||
| e912d59387 | |||
| 721df57437 | |||
| 21adf11259 | |||
| 94605e0cdf | |||
| ff947fe3e9 | |||
| 35afc95be0 | |||
| 4f918ce4df | |||
| e3f10494a8 | |||
| 7cf09e2e6e | |||
| deb771502d | |||
| e5734e3ce7 |
12
.github/workflows/release-drafter.yml
vendored
12
.github/workflows/release-drafter.yml
vendored
@ -9,14 +9,4 @@ on:
|
||||
jobs:
|
||||
update_release_draft:
|
||||
name: Update Release Draft
|
||||
runs-on: ubuntu-latest
|
||||
concurrency: release-drafter
|
||||
|
||||
if: >
|
||||
github.repository_owner == 's4u'
|
||||
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
|
||||
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5.21.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
uses: s4u/.github/.github/workflows/release-drafter.yml@master
|
||||
|
||||
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
@ -18,14 +18,14 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
|
||||
java: [ '8', '11', '17' ]
|
||||
maven: [ '3.5.4', '3.6.3', '3.8.6' ]
|
||||
java: [ '8', '11', '17', '21' ]
|
||||
maven: [ '3.8.8', '3.9.9' ]
|
||||
fail-fast: false
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
|
||||
- uses: ./
|
||||
with:
|
||||
@ -36,31 +36,27 @@ jobs:
|
||||
- run: mvn -V validate -Drequire.java=${{ matrix.java }} -Drequire.maven=${{ matrix.maven }}
|
||||
shell: bash
|
||||
|
||||
test-deault:
|
||||
test-default:
|
||||
name: Test with defaults
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
|
||||
- uses: ./
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- run: mvn -V validate -Drequire.java=8 -Drequire.maven=3.8.6
|
||||
- run: mvn -V validate -Drequire.java=17 -Drequire.maven=3.9.9
|
||||
shell: bash
|
||||
|
||||
test-ok:
|
||||
name: Test OK
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ test, test-deault ]
|
||||
needs: [ test, test-default ]
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- run: echo "needs.test.result=${{ needs.test.result }} needs.test-deault.result=${{ needs.test-deault.result }}"
|
||||
|
||||
- run: 'true'
|
||||
if: needs.test.result == 'success' && needs.test-deault.result == 'success'
|
||||
if: join(needs.*.result, ',') == 'success,success'
|
||||
|
||||
- run: 'false'
|
||||
if: needs.test.result != 'success' || needs.test-deault.result != 'success'
|
||||
if: join(needs.*.result, ',') != 'success,success'
|
||||
|
||||
62
README.md
62
README.md
@ -9,38 +9,41 @@ This is composite action which help to prepare GitHub Actions environment for Ma
|
||||
- [stCarolas/setup-maven](https://github.com/marketplace/actions/setup-maven)
|
||||
- [s4u/maven-settings-action](https://github.com/marketplace/actions/maven-settings-action)
|
||||
|
||||
# Contributions
|
||||
:exclamation: You **should not** include above actions in your configuration - in other case those will be **called twice**. :exclamation:
|
||||
|
||||
- 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
|
||||
For default values you only need:
|
||||
|
||||
# Project versioning
|
||||
```yml
|
||||
steps:
|
||||
|
||||
This project uses [Semantic Versioning](https://semver.org/).
|
||||
We recommended using 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).
|
||||
- name: Setup Maven Action
|
||||
uses: s4u/setup-maven-action@< version >
|
||||
|
||||
- run: mvn -V ...
|
||||
```
|
||||
|
||||
# Params mapping for sub actions
|
||||
|
||||
**Notice** when used this action you should not used mentioned below actions again.
|
||||
|
||||
## checkout
|
||||
|
||||
| params | destination | default |
|
||||
|------------------------------|---------------------|---------|
|
||||
| checkout-fetch-depth | fetch-depth | |
|
||||
| checkout-path | path | |
|
||||
| checkout-persist-credentials | persist-credentials | false |
|
||||
| params | destination | default |
|
||||
|------------------------------|---------------------|--------------------------|
|
||||
| checkout-enabled | enabled | true |
|
||||
| checkout-fetch-depth | fetch-depth | |
|
||||
| checkout-submodules | submodules | |
|
||||
| checkout-path | path | |
|
||||
| checkout-ref | ref | |
|
||||
| checkout-repository | repository | ${{ github.repository }} |
|
||||
| checkout-token | token | ${{ github.token }} |
|
||||
| checkout-ssh-key | ssh-key | |
|
||||
| checkout-persist-credentials | persist-credentials | false |
|
||||
|
||||
## setup-java
|
||||
|
||||
| params | destination | default |
|
||||
|-------------------|--------------|---------|
|
||||
| java-version | java-version | |
|
||||
| java-distribution | distribution | temurin |
|
||||
| java-version | java-version | 17 |
|
||||
| java-distribution | distribution | zulu |
|
||||
|
||||
## cache
|
||||
|
||||
@ -60,6 +63,7 @@ So we can use for action:
|
||||
|
||||
| params | description |
|
||||
|----------------|----------------------------------------------------------|
|
||||
| cache-enabled | enable cache. Default true |
|
||||
| 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 |
|
||||
@ -69,7 +73,7 @@ So we can use for action:
|
||||
|
||||
| params | destination | default |
|
||||
|---------------|---------------|---------|
|
||||
| maven-version | maven-version | 3.8.6 |
|
||||
| maven-version | maven-version | 3.9.9 |
|
||||
|
||||
## maven-settings-action
|
||||
|
||||
@ -79,6 +83,8 @@ So we can use for action:
|
||||
| settings-mirrors | mirrors |
|
||||
| settings-properties | properties |
|
||||
| settings-sonatypeSnapshots | sonatypeSnapshots |
|
||||
| settings-proxies | proxies |
|
||||
| settings-repositories | repositories |
|
||||
|
||||
# Testing against different Maven versions
|
||||
|
||||
@ -90,7 +96,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
maven: [ '3.5.4', '3.6.3', '3.8.6' ]
|
||||
maven: [ '3.8.8', '3.9.8' ]
|
||||
|
||||
name: Maven ${{ matrix.maven }} sample
|
||||
|
||||
@ -105,6 +111,20 @@ jobs:
|
||||
- run: mvn -V ...
|
||||
```
|
||||
|
||||
# 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 using 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).
|
||||
|
||||
# License
|
||||
|
||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||
|
||||
77
action.yml
77
action.yml
@ -8,10 +8,19 @@ branding:
|
||||
inputs:
|
||||
|
||||
# checkout
|
||||
checkout-enabled:
|
||||
description: 'Enable checkout'
|
||||
default: 'true'
|
||||
required: false
|
||||
|
||||
checkout-fetch-depth:
|
||||
description: 'Number of commits to fetch'
|
||||
required: false
|
||||
|
||||
checkout-submodules:
|
||||
description: 'Whether to fetch submodules'
|
||||
required: false
|
||||
|
||||
checkout-path:
|
||||
description: 'Relative path under $GITHUB_WORKSPACE to place the repository'
|
||||
required: false
|
||||
@ -21,19 +30,42 @@ inputs:
|
||||
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 }}
|
||||
|
||||
checkout-ssh-key:
|
||||
description: 'SSH key used to fetch the repository. It allows to run authenticated git commands'
|
||||
required: false
|
||||
|
||||
# java jdk params
|
||||
|
||||
java-version:
|
||||
description: 'The Java version to set up'
|
||||
default: '17'
|
||||
required: true
|
||||
|
||||
java-distribution:
|
||||
description: 'Java distribution'
|
||||
default: 'temurin'
|
||||
default: 'zulu'
|
||||
required: false
|
||||
|
||||
# cache
|
||||
cache-enabled:
|
||||
description: 'Enable cache'
|
||||
default: 'true'
|
||||
required: false
|
||||
|
||||
cache-prefix:
|
||||
description: 'Cache key prefix'
|
||||
required: false
|
||||
@ -50,44 +82,59 @@ inputs:
|
||||
# maven version
|
||||
maven-version:
|
||||
description: 'The Maven version to set up'
|
||||
default: '3.8.6'
|
||||
default: '3.9.9'
|
||||
required: false
|
||||
|
||||
# maven settings.xml
|
||||
settings-servers:
|
||||
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
description: 'servers definition in json array, e.g.: [{"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"}]'
|
||||
description: 'mirrors definition in json array, e.g.: [{"id": "id", "name": "name", "mirrorOf": "mirrorOf", "url": "url"}]'
|
||||
required: false
|
||||
|
||||
settings-properties:
|
||||
description: 'json array with properties, eg [{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
description: 'json array with properties, e.g.: [{"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
|
||||
|
||||
settings-proxies:
|
||||
description: 'proxies definition in json array, e.g.: [{"id": "http-proxy", "active": "true", "protocol": "http", "host": "host", "port": "port", "nonProxyHosts": "host1|host2"}]'
|
||||
required: false
|
||||
|
||||
settings-repositories:
|
||||
description: 'repository settings definition in json array, e.g.: [ { "id": "repoId","name": "repoName","url": "url","snapshots": { "enabled": true } } ]'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||
if: inputs.checkout-enabled == 'true'
|
||||
with:
|
||||
fetch-depth: '${{ inputs.checkout-fetch-depth }}'
|
||||
submodules: '${{ inputs.checkout-submodules }}'
|
||||
path: '${{ inputs.checkout-path }}'
|
||||
persist-credentials: '${{ inputs.checkout-persist-credentials }}'
|
||||
ref: '${{ inputs.checkout-ref }}'
|
||||
repository: '${{ inputs.checkout-repository }}'
|
||||
token: '${{ inputs.checkout-token }}'
|
||||
ssh-key: '${{ inputs.checkout-ssh-key }}'
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73
|
||||
with:
|
||||
overwrite-settings: false
|
||||
java-version: '${{ inputs.java-version }}'
|
||||
distribution: '${{ inputs.java-distribution }}'
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
|
||||
if: inputs.cache-enabled == 'true'
|
||||
with:
|
||||
path: |
|
||||
${{ inputs.cache-path }}
|
||||
@ -100,14 +147,16 @@ runs:
|
||||
shell: bash
|
||||
id: current-maven
|
||||
|
||||
- uses: stCarolas/setup-maven@v4.5
|
||||
- uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
|
||||
if: inputs.maven-version != steps.current-maven.outputs.version
|
||||
with:
|
||||
maven-version: '${{ inputs.maven-version }}'
|
||||
|
||||
- uses: s4u/maven-settings-action@v2.8.0
|
||||
- uses: s4u/maven-settings-action@7802f6aec16c9098b4798ad1f1d8ac75198194bd # v3.0.0
|
||||
with:
|
||||
servers: '${{ inputs.settings-servers}}'
|
||||
mirrors: '${{ inputs.settings-mirrors}}'
|
||||
properties: '${{ inputs.settings-properties}}'
|
||||
sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots}}'
|
||||
servers: '${{ inputs.settings-servers }}'
|
||||
mirrors: '${{ inputs.settings-mirrors }}'
|
||||
properties: '${{ inputs.settings-properties }}'
|
||||
sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots }}'
|
||||
proxies: '${{ inputs.settings-proxies }}'
|
||||
repositories: '${{ inputs.settings-repositories }}'
|
||||
|
||||
34
pom.xml
34
pom.xml
@ -36,7 +36,6 @@
|
||||
<properties>
|
||||
<require.maven/>
|
||||
<require.java/>
|
||||
<_require.java/>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@ -44,11 +43,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M3</version>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>display-info</goal>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<phase>validate</phase>
|
||||
@ -57,7 +55,7 @@
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireJavaVersion>
|
||||
<version>${_require.java}</version>
|
||||
<version>${require.java}</version>
|
||||
</requireJavaVersion>
|
||||
<requireMavenVersion>
|
||||
<version>[${require.maven}]</version>
|
||||
@ -67,32 +65,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>java8-version-label</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>require.java</name>
|
||||
<value>8</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<_require.java>1.8</_require.java>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>non-java8-version-label</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>require.java</name>
|
||||
<value>!8</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<_require.java>${require.java}</_require.java>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user