Download ossutil from CDN endpoint (#30)

* use cdn to download

* set default version to 1.7.14

* schedule daily test

* bump up version 1.1.1

* use 'latest' in CI test
This commit is contained in:
Rimo
2022-09-28 22:49:06 +08:00
committed by GitHub
parent 0677c3a661
commit 7771e4ad5d
8 changed files with 25 additions and 18 deletions

12
dist/index.js generated vendored
View File

@@ -45,7 +45,8 @@ const tc = __importStar(__nccwpck_require__(7784));
const fs = __importStar(__nccwpck_require__(5747));
const http_client_1 = __nccwpck_require__(6255);
const ToolName = 'ossutil';
const UpdateEndpoint = 'https://ossutil-version-update.oss-cn-hangzhou.aliyuncs.com';
const UpdateUrl = 'https://ossutil-version-update.oss-cn-hangzhou.aliyuncs.com/ossutilversion';
const DownloadEndpoint = 'https://gosspublic.alicdn.com/ossutil';
/**
* Get ossutil ready for use
* @param version the version of ossutil
@@ -98,7 +99,7 @@ function downloadOssutil(version) {
* @returns the URL
*/
function getDownloadUrl(version) {
let downloadUrl = `${UpdateEndpoint}/${version}/`;
let downloadUrl = `${DownloadEndpoint}/${version}/`;
switch (process.platform) {
case 'linux':
downloadUrl += 'ossutil64';
@@ -120,8 +121,11 @@ function getDownloadUrl(version) {
*/
function getLatestVersion() {
return __awaiter(this, void 0, void 0, function* () {
const http = new http_client_1.HttpClient();
const response = yield http.get(`${UpdateEndpoint}/ossutilversion`);
const http = new http_client_1.HttpClient('setup-ossutil', [], {
allowRetries: true,
maxRetries: 5
});
const response = yield http.get(UpdateUrl);
const content = yield response.readBody();
return content.trim();
});

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long