diff --git a/action.yml b/action.yml index eaed535..85c7e70 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,9 @@ inputs: maven-version: description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0' default: '3.8.2' + download-url: + description: 'Custom use download url' + default: '' runs: using: 'node20' main: 'lib/setup-maven.js' diff --git a/lib/installer.js b/lib/installer.js index 74aa9ce..a46ecef 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -53,22 +53,25 @@ if (!tempDirectory) { } tempDirectory = path.join(baseLocation, 'actions', 'temp'); } -function getMaven(version) { +function getMaven(version, customDownloadUrl) { return __awaiter(this, void 0, void 0, function* () { let toolPath; toolPath = tc.find('maven', version); if (!toolPath) { - toolPath = yield downloadMaven(version); + toolPath = yield downloadMaven(version, customDownloadUrl); } toolPath = path.join(toolPath, 'bin'); core.addPath(toolPath); }); } exports.getMaven = getMaven; -function downloadMaven(version) { +function downloadMaven(version, customDownloadUrl) { return __awaiter(this, void 0, void 0, function* () { const toolDirectoryName = `apache-maven-${version}`; - const downloadUrl = `https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${version}/apache-maven-${version}-bin.tar.gz`; + let downloadUrl = `https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${version}/apache-maven-${version}-bin.tar.gz`; + if (customDownloadUrl) { + downloadUrl = customDownloadUrl; + } console.log(`downloading ${downloadUrl}`); try { const downloadPath = yield tc.downloadTool(downloadUrl); diff --git a/lib/setup-maven.js b/lib/setup-maven.js index 4ef56e4..01022a4 100644 --- a/lib/setup-maven.js +++ b/lib/setup-maven.js @@ -38,8 +38,9 @@ function run() { return __awaiter(this, void 0, void 0, function* () { try { let version = core.getInput('maven-version'); + let customDownloadUrl = core.getInput('download-url'); if (version) { - yield installer.getMaven(version); + yield installer.getMaven(version, customDownloadUrl); } } catch (error) {