Skip to content

Commit 9a92af2

Browse files
authored
chore(scripts): reuse java-version (#4696)
1 parent c19ee6a commit 9a92af2

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
21.0.6+7.0.LTS
1+
21.0.6

config/.java-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../clients/algoliasearch-client-java/.java-version

scripts/ci/githubActions/createMatrix.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createClientName, exists, GENERATORS, LANGUAGES, toAbsolutePath } from
66
import { getClientsConfigField, getLanguageFolder, getTestExtension, getTestOutputFolder } from '../../config.ts';
77

88
import type { ClientMatrix, CreateMatrix, ToRunMatrix } from './types.ts';
9-
import { COMMON_DEPENDENCIES, DEPENDENCIES, isBaseChanged } from './utils.ts';
9+
import { COMMON_DEPENDENCIES, DEPENDENCIES, getVersionFileForLanguage, isBaseChanged } from './utils.ts';
1010

1111
// This empty matrix is required by the CI, otherwise it throws
1212
const EMPTY_MATRIX = { client: ['no-run'] };
@@ -66,11 +66,7 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
6666

6767
const testsRootFolder = `tests/output/${language}`;
6868
const testsOutputBase = `${testsRootFolder}/${getTestOutputFolder(language)}`;
69-
const versionFile = toAbsolutePath(
70-
language === 'javascript'
71-
? '.nvmrc'
72-
: `config/.${language === 'kotlin' || language === 'scala' ? 'java' : language}-version`,
73-
);
69+
const versionFile = toAbsolutePath(getVersionFileForLanguage(language));
7470
let version: string | undefined = undefined;
7571
if (await exists(versionFile)) {
7672
version = (await fsp.readFile(versionFile)).toString();

scripts/ci/githubActions/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const DEPENDENCIES = {
6262
WEBSITE_CHANGED: ['website', 'scripts/website', 'package.json', 'netlify.toml'],
6363
};
6464

65-
function getVersionFileForLanguage(lang: Language): string {
65+
export function getVersionFileForLanguage(lang: Language): string {
6666
// js rely on the nvmrc of the repo
6767
if (lang === 'javascript') {
6868
return '.nvmrc';

0 commit comments

Comments
 (0)