forked from s4u/setup-maven-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
183 lines (146 loc) · 6.05 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: 'Setup Maven Action'
description: 'Complete environment configuration for Maven builds'
branding:
icon: 'settings'
color: 'green'
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
checkout-persist-credentials:
description: 'Whether to configure the token or SSH key with the local git config'
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: 'zulu'
required: false
java-jdkFile:
description: 'Java JDK compressed file location'
required: false
# cache
cache-enabled:
description: 'Enable cache'
default: 'true'
required: false
cache-prefix:
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:
description: 'The Maven version to set up'
default: '3.9.9'
required: false
# maven settings.xml
settings-servers:
description: 'servers definition in json array, e.g.: [{"id": "serverId", "username": "username", "password": "password"}]'
required: false
settings-mirrors:
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, 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
settings-pluginRepositories:
description: 'plugin repository settings definition in json array, e.g.: [{"id":"repoId","name":"repoName","url":"url","snapshots":{"enabled":true}}]'
required: false
settings-githubServer:
description: 'add to settings.xml servers server-id: github; username=$GITHUB_ACTOR and password=$GITHUB_TOKEN'
default: "true"
required: false
settings-path:
description: 'override default path to settings.xml which is $HOME/.m2/settings.xml'
required: false
runs:
using: 'composite'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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@8df1039502a15bceb9433410b1a100fbe190c53b
with:
overwrite-settings: false
java-version: '${{ inputs.java-version }}'
distribution: '${{ inputs.java-distribution }}'
jdkFile: '${{ inputs.java-jdkFile }}'
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: inputs.cache-enabled == 'true'
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 }}-
- name: Installed Maven version
run: echo "version=$(mvn -q -v)" >> $GITHUB_OUTPUT
shell: bash
id: current-maven
- 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@64e42c454dbd42ef6370ac8539685755aedd205b # v3.1.0
with:
servers: '${{ inputs.settings-servers }}'
mirrors: '${{ inputs.settings-mirrors }}'
properties: '${{ inputs.settings-properties }}'
sonatypeSnapshots: '${{ inputs.settings-sonatypeSnapshots }}'
proxies: '${{ inputs.settings-proxies }}'
repositories: '${{ inputs.settings-repositories }}'
pluginRepositories: '${{ inputs.settings-pluginRepositories }}'
githubServer: '${{ inputs.settings-githubServer }}'
path: '${{ inputs.settings-path }}'