Skip to content

Commit 4473697

Browse files
authored
Merge branch 'main' into mhoffrog/552_allow_to_add_a_toolchain_only
2 parents 48a9cd5 + ead9eaa commit 4473697

File tree

12 files changed

+109
-101
lines changed

12 files changed

+109
-101
lines changed

README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,20 @@ The `setup-java` action provides the following functionality for GitHub Actions
1818

1919
This action allows you to work with Java and Scala projects.
2020

21+
## Breaking changes in V5
22+
23+
- Upgraded action from node20 to node24
24+
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
25+
26+
For more details, see the full release notes on the [releases page](https://github.com/actions/setup-java/releases/tag/v5.0.0)
27+
2128
## V2 vs V1
2229

2330
- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
2431
- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
2532

33+
For information about the latest releases, recent updates, and newly supported distributions, please refer to the `setup-java` [Releases](https://github.com/actions/setup-java/releases).
34+
2635
## Usage
2736

2837
- `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified.
@@ -75,8 +84,8 @@ This action allows you to work with Java and Scala projects.
7584
#### Eclipse Temurin
7685
```yaml
7786
steps:
78-
- uses: actions/checkout@v4
79-
- uses: actions/setup-java@v4
87+
- uses: actions/checkout@v5
88+
- uses: actions/setup-java@v5
8089
with:
8190
distribution: 'temurin' # See 'Supported distributions' for available options
8291
java-version: '21'
@@ -86,8 +95,8 @@ steps:
8695
#### Azul Zulu OpenJDK
8796
```yaml
8897
steps:
89-
- uses: actions/checkout@v4
90-
- uses: actions/setup-java@v4
98+
- uses: actions/checkout@v5
99+
- uses: actions/setup-java@v5
91100
with:
92101
distribution: 'zulu' # See 'Supported distributions' for available options
93102
java-version: '21'
@@ -142,8 +151,8 @@ The cache input is optional, and caching is turned off by default.
142151
#### Caching gradle dependencies
143152
```yaml
144153
steps:
145-
- uses: actions/checkout@v4
146-
- uses: actions/setup-java@v4
154+
- uses: actions/checkout@v5
155+
- uses: actions/setup-java@v5
147156
with:
148157
distribution: 'temurin'
149158
java-version: '21'
@@ -157,8 +166,8 @@ steps:
157166
#### Caching maven dependencies
158167
```yaml
159168
steps:
160-
- uses: actions/checkout@v4
161-
- uses: actions/setup-java@v4
169+
- uses: actions/checkout@v5
170+
- uses: actions/setup-java@v5
162171
with:
163172
distribution: 'temurin'
164173
java-version: '21'
@@ -171,8 +180,8 @@ steps:
171180
#### Caching sbt dependencies
172181
```yaml
173182
steps:
174-
- uses: actions/checkout@v4
175-
- uses: actions/setup-java@v4
183+
- uses: actions/checkout@v5
184+
- uses: actions/setup-java@v5
176185
with:
177186
distribution: 'temurin'
178187
java-version: '21'
@@ -191,8 +200,8 @@ Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a
191200
env:
192201
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
193202
steps:
194-
- uses: actions/checkout@v4
195-
- uses: actions/setup-java@v4
203+
- uses: actions/checkout@v5
204+
- uses: actions/setup-java@v5
196205
with:
197206
distribution: 'temurin'
198207
java-version: '21'
@@ -211,8 +220,8 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
211220

212221
```yaml
213222
steps:
214-
- uses: actions/checkout@v4
215-
- uses: actions/setup-java@v4
223+
- uses: actions/checkout@v5
224+
- uses: actions/setup-java@v5
216225
with:
217226
distribution: 'temurin'
218227
java-version: '21'
@@ -230,9 +239,9 @@ jobs:
230239
java: [ '8', '11', '17', '21' ]
231240
name: Java ${{ matrix.Java }} sample
232241
steps:
233-
- uses: actions/checkout@v4
242+
- uses: actions/checkout@v5
234243
- name: Setup java
235-
uses: actions/setup-java@v4
244+
uses: actions/setup-java@v5
236245
with:
237246
distribution: '<distribution>'
238247
java-version: ${{ matrix.java }}
@@ -241,11 +250,11 @@ jobs:
241250

242251
### Install multiple JDKs
243252

244-
By default all versions are added to the PATH. The last version will be used and available globally. Other Java versions can be accessed through env variables with such specification as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'.
253+
All configured Java versions are added to the PATH. The last one added to the PATH (i.e., the last JDK set up by this action) will be used as the default and available globally. Other Java versions can be accessed through environment variables such as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. To use a specific Java version, set the JAVA_HOME environment variable accordingly and prepend its bin directory to the PATH to ensure it takes priority during execution.
245254

246255
```yaml
247256
steps:
248-
- uses: actions/setup-java@v4
257+
- uses: actions/setup-java@v5
249258
with:
250259
distribution: '<distribution>'
251260
java-version: |

__tests__/distributors/corretto-installer.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ describe('getAvailableVersions', () => {
150150
});
151151
mockPlatform(distribution, platform);
152152

153-
const availableVersion = await distribution['findPackageForDownload'](
154-
version
155-
);
153+
const availableVersion =
154+
await distribution['findPackageForDownload'](version);
156155
expect(availableVersion).not.toBeNull();
157156
expect(availableVersion.url).toBe(expectedLink);
158157
});
@@ -222,9 +221,8 @@ describe('getAvailableVersions', () => {
222221

223222
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
224223

225-
const availableVersion = await distribution['findPackageForDownload'](
226-
'17'
227-
);
224+
const availableVersion =
225+
await distribution['findPackageForDownload']('17');
228226
expect(availableVersion).not.toBeNull();
229227
expect(availableVersion.url).toBe(expectedLink);
230228
}

__tests__/distributors/dragonwell-installer.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ describe('getAvailableVersions', () => {
206206
});
207207
mockPlatform(distribution, platform);
208208

209-
const availableVersion = await distribution['findPackageForDownload'](
210-
jdkVersion
211-
);
209+
const availableVersion =
210+
await distribution['findPackageForDownload'](jdkVersion);
212211
expect(availableVersion).not.toBeNull();
213212
expect(availableVersion.url).toBe(expectedLink);
214213
}

__tests__/distributors/jetbrains-installer.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ describe('findPackageForDownload', () => {
7676
checkLatest: false
7777
});
7878
distribution['getAvailableVersions'] = async () => manifestData as any;
79-
const resolvedVersion = await distribution['findPackageForDownload'](
80-
input
81-
);
79+
const resolvedVersion =
80+
await distribution['findPackageForDownload'](input);
8281
const url = resolvedVersion.url;
8382
const options = {method: 'HEAD'};
8483

__tests__/distributors/sapmachine-installer.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ describe('getAvailableVersions', () => {
6161

6262
mockPlatform(distribution, 'linux');
6363

64-
const availableVersion = await distribution['findPackageForDownload'](
65-
version
66-
);
64+
const availableVersion =
65+
await distribution['findPackageForDownload'](version);
6766
expect(availableVersion).not.toBeNull();
6867
expect(availableVersion.url).toBe(
6968
'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz'
@@ -230,9 +229,8 @@ describe('getAvailableVersions', () => {
230229
});
231230
mockPlatform(distribution, platform);
232231

233-
const availableVersion = await distribution['findPackageForDownload'](
234-
normalizedVersion
235-
);
232+
const availableVersion =
233+
await distribution['findPackageForDownload'](normalizedVersion);
236234
expect(availableVersion).not.toBeNull();
237235
expect(availableVersion.url).toBe(expectedLink);
238236
}

dist/cleanup/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94707,7 +94707,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
9470794707
const versionFileName = getFileName(versionFile);
9470894708
if (versionFileName == '.tool-versions') {
9470994709
javaVersionRegExp =
94710-
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m;
94710+
/^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
9471194711
}
9471294712
else {
9471394713
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;

dist/setup/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132760,7 +132760,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
132760132760
const versionFileName = getFileName(versionFile);
132761132761
if (versionFileName == '.tool-versions') {
132762132762
javaVersionRegExp =
132763-
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m;
132763+
/^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
132764132764
}
132765132765
else {
132766132766
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;

0 commit comments

Comments
 (0)