增加自定义下载地址
This commit is contained in:
parent
d6af6abeda
commit
99a50f75f7
|
@ -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'
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue