mirror of
https://github.com/s4u/setup-maven-action.git
synced 2026-02-16 00:00:14 +08:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c4f3ff3dc | |||
| e435effde6 | |||
| e97b30e967 | |||
| ae19451abc | |||
| 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:
|
jobs:
|
||||||
update_release_draft:
|
update_release_draft:
|
||||||
name: Update Release Draft
|
name: Update Release Draft
|
||||||
runs-on: ubuntu-latest
|
uses: s4u/.github/.github/workflows/release-drafter.yml@master
|
||||||
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 }}
|
|
||||||
|
|||||||
45
.github/workflows/test.yml
vendored
45
.github/workflows/test.yml
vendored
@ -18,14 +18,14 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
|
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
|
||||||
java: [ '8', '11', '17' ]
|
java: [ '8', '11', '17', '21' ]
|
||||||
maven: [ '3.5.4', '3.6.3', '3.8.6' ]
|
maven: [ '3.8.8', '3.9.6' ]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
@ -36,31 +36,50 @@ jobs:
|
|||||||
- 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:
|
test-default:
|
||||||
name: Test with defaults
|
name: Test with defaults
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: ./
|
||||||
|
|
||||||
|
- run: mvn -V validate -Drequire.java=17 -Drequire.maven=3.9.6
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# regressions tests
|
||||||
|
test-issue-68:
|
||||||
|
name: Test for issue 68
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
java-version: 8
|
settings-servers: |
|
||||||
|
[{
|
||||||
|
"id": "ossrh",
|
||||||
|
"username": "${{ vars.TEST_68_1 }}",
|
||||||
|
"password": "${{ vars.TEST_68_2 }}"
|
||||||
|
}]
|
||||||
|
|
||||||
- run: mvn -V validate -Drequire.java=8 -Drequire.maven=3.8.6
|
- run: cat ~/.m2/settings.xml
|
||||||
shell: bash
|
- run: |
|
||||||
|
grep "<id>ossrh</id>" ~/.m2/settings.xml
|
||||||
|
grep "<username>username-68</username>" ~/.m2/settings.xml
|
||||||
|
grep "<password>password-68</password>" ~/.m2/settings.xml
|
||||||
|
|
||||||
test-ok:
|
test-ok:
|
||||||
name: Test OK
|
name: Test OK
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ test, test-deault ]
|
needs: [ test, test-default, test-issue-68 ]
|
||||||
if: always()
|
if: always()
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: echo "needs.test.result=${{ needs.test.result }} needs.test-deault.result=${{ needs.test-deault.result }}"
|
|
||||||
|
|
||||||
- run: 'true'
|
- run: 'true'
|
||||||
if: needs.test.result == 'success' && needs.test-deault.result == 'success'
|
if: join(needs.*.result, ',') == 'success,success,success'
|
||||||
|
|
||||||
- run: 'false'
|
- run: 'false'
|
||||||
if: needs.test.result != 'success' || needs.test-deault.result != 'success'
|
if: join(needs.*.result, ',') != 'success,success,success'
|
||||||
|
|||||||
55
README.md
55
README.md
@ -9,37 +9,37 @@ This is composite action which help to prepare GitHub Actions environment for Ma
|
|||||||
- [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
|
:exclamation: You **should not** include above actions in your configuration - in other case those will be **called twice**. :exclamation:
|
||||||
|
|
||||||
- Contributions are welcome!
|
For default values you only need:
|
||||||
- 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
|
```yml
|
||||||
|
steps:
|
||||||
|
|
||||||
This project uses [Semantic Versioning](https://semver.org/).
|
- name: Setup Maven Action
|
||||||
We recommended using the latest and specific release version.
|
uses: s4u/setup-maven-action@< 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).
|
|
||||||
|
|
||||||
|
- run: mvn -V ...
|
||||||
|
```
|
||||||
|
|
||||||
# Params mapping for sub actions
|
# Params mapping for sub actions
|
||||||
|
|
||||||
**Notice** when used this action you should not used mentioned below actions again.
|
|
||||||
|
|
||||||
## checkout
|
## checkout
|
||||||
|
|
||||||
| params | destination | default |
|
| params | destination | default |
|
||||||
|------------------------------|---------------------|---------|
|
|------------------------------|---------------------|--------------------------|
|
||||||
| checkout-fetch-depth | fetch-depth | |
|
| checkout-fetch-depth | fetch-depth | |
|
||||||
| checkout-path | path | |
|
| checkout-path | path | |
|
||||||
| checkout-persist-credentials | persist-credentials | false |
|
| checkout-ref | ref | |
|
||||||
|
| checkout-repository | repository | ${{ github.repository }} |
|
||||||
|
| checkout-token | token | ${{ github.token }} |
|
||||||
|
| checkout-persist-credentials | persist-credentials | false |
|
||||||
|
|
||||||
## setup-java
|
## setup-java
|
||||||
|
|
||||||
| params | destination | default |
|
| params | destination | default |
|
||||||
|-------------------|--------------|---------|
|
|-------------------|--------------|---------|
|
||||||
| java-version | java-version | |
|
| java-version | java-version | 17 |
|
||||||
| java-distribution | distribution | temurin |
|
| java-distribution | distribution | temurin |
|
||||||
|
|
||||||
## cache
|
## cache
|
||||||
@ -60,6 +60,7 @@ So we can use for action:
|
|||||||
|
|
||||||
| params | description |
|
| params | description |
|
||||||
|----------------|----------------------------------------------------------|
|
|----------------|----------------------------------------------------------|
|
||||||
|
| cache-enabled | enable cache. Default true |
|
||||||
| cache-path | default cache path for Maven with value ~/.m2/repository |
|
| cache-path | default cache path for Maven with value ~/.m2/repository |
|
||||||
| cache-path-add | additional value for cache path |
|
| cache-path-add | additional value for cache path |
|
||||||
| cache-prefix | prefix value for `key` and `restore-keys` cache params |
|
| cache-prefix | prefix value for `key` and `restore-keys` cache params |
|
||||||
@ -69,7 +70,7 @@ So we can use for action:
|
|||||||
|
|
||||||
| params | destination | default |
|
| params | destination | default |
|
||||||
|---------------|---------------|---------|
|
|---------------|---------------|---------|
|
||||||
| maven-version | maven-version | 3.8.6 |
|
| maven-version | maven-version | 3.9.6 |
|
||||||
|
|
||||||
## maven-settings-action
|
## maven-settings-action
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
maven: [ '3.5.4', '3.6.3', '3.8.6' ]
|
maven: [ '3.8.8', '3.9.6' ]
|
||||||
|
|
||||||
name: Maven ${{ matrix.maven }} sample
|
name: Maven ${{ matrix.maven }} sample
|
||||||
|
|
||||||
@ -105,6 +106,20 @@ jobs:
|
|||||||
- run: mvn -V ...
|
- 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
|
# License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|||||||
35
action.yml
35
action.yml
@ -21,11 +21,25 @@ inputs:
|
|||||||
default: 'false'
|
default: 'false'
|
||||||
required: 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 }}
|
||||||
|
|
||||||
# java jdk params
|
# java jdk params
|
||||||
|
|
||||||
java-version:
|
java-version:
|
||||||
description: 'The Java version to set up'
|
description: 'The Java version to set up'
|
||||||
|
default: '17'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
java-distribution:
|
java-distribution:
|
||||||
@ -34,6 +48,11 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
|
|
||||||
# cache
|
# cache
|
||||||
|
cache-enabled:
|
||||||
|
description: 'Enable cache'
|
||||||
|
default: 'true'
|
||||||
|
required: false
|
||||||
|
|
||||||
cache-prefix:
|
cache-prefix:
|
||||||
description: 'Cache key prefix'
|
description: 'Cache key prefix'
|
||||||
required: false
|
required: false
|
||||||
@ -50,7 +69,7 @@ inputs:
|
|||||||
# 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.6'
|
default: '3.9.6'
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
# maven settings.xml
|
# maven settings.xml
|
||||||
@ -75,19 +94,23 @@ runs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: '${{ inputs.checkout-fetch-depth }}'
|
fetch-depth: '${{ inputs.checkout-fetch-depth }}'
|
||||||
path: '${{ inputs.checkout-path }}'
|
path: '${{ inputs.checkout-path }}'
|
||||||
persist-credentials: '${{ inputs.checkout-persist-credentials }}'
|
persist-credentials: '${{ inputs.checkout-persist-credentials }}'
|
||||||
|
ref: '${{ inputs.checkout-ref }}'
|
||||||
|
repository: '${{ inputs.checkout-repository }}'
|
||||||
|
token: '${{ inputs.checkout-token }}'
|
||||||
|
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v4
|
||||||
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 }}'
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v4
|
||||||
|
if: inputs.cache-enabled == 'true'
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
${{ inputs.cache-path }}
|
${{ inputs.cache-path }}
|
||||||
@ -100,12 +123,12 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
id: current-maven
|
id: current-maven
|
||||||
|
|
||||||
- uses: stCarolas/setup-maven@v4.5
|
- uses: stCarolas/setup-maven@v5
|
||||||
if: inputs.maven-version != steps.current-maven.outputs.version
|
if: inputs.maven-version != steps.current-maven.outputs.version
|
||||||
with:
|
with:
|
||||||
maven-version: '${{ inputs.maven-version }}'
|
maven-version: '${{ inputs.maven-version }}'
|
||||||
|
|
||||||
- uses: s4u/maven-settings-action@v2.8.0
|
- uses: s4u/maven-settings-action@v3.0.0
|
||||||
with:
|
with:
|
||||||
servers: '${{ inputs.settings-servers}}'
|
servers: '${{ inputs.settings-servers}}'
|
||||||
mirrors: '${{ inputs.settings-mirrors}}'
|
mirrors: '${{ inputs.settings-mirrors}}'
|
||||||
|
|||||||
34
pom.xml
34
pom.xml
@ -36,7 +36,6 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<require.maven/>
|
<require.maven/>
|
||||||
<require.java/>
|
<require.java/>
|
||||||
<_require.java/>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -44,11 +43,10 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-enforcer-plugin</artifactId>
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
<version>3.0.0-M3</version>
|
<version>3.2.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>display-info</goal>
|
|
||||||
<goal>enforce</goal>
|
<goal>enforce</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<phase>validate</phase>
|
<phase>validate</phase>
|
||||||
@ -57,7 +55,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<rules>
|
<rules>
|
||||||
<requireJavaVersion>
|
<requireJavaVersion>
|
||||||
<version>${_require.java}</version>
|
<version>${require.java}</version>
|
||||||
</requireJavaVersion>
|
</requireJavaVersion>
|
||||||
<requireMavenVersion>
|
<requireMavenVersion>
|
||||||
<version>[${require.maven}]</version>
|
<version>[${require.maven}]</version>
|
||||||
@ -67,32 +65,4 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</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>
|
</project>
|
||||||
|
|||||||
Reference in New Issue
Block a user