Fix Windows build download link (#32)
* fix windows download * update test.yml: add version matrix * update dist
This commit is contained in:
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -12,12 +12,13 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
version: [1.7.0, 1.7.14, latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./
|
||||
with:
|
||||
ossutil-version: 'latest'
|
||||
ossutil-version: ${{ matrix.version }}
|
||||
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
||||
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
||||
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('installer tests', () => {
|
||||
await io.rmRF(TEMP_DIR)
|
||||
})
|
||||
|
||||
const versions = ['1.7.14']
|
||||
const versions = ['1.7.0', '1.7.14']
|
||||
|
||||
it.each(versions)('install ossutil %s', async version => {
|
||||
await installer.installOssutil(version)
|
||||
|
||||
12
dist/index.js
generated
vendored
12
dist/index.js
generated
vendored
@@ -41,9 +41,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.installOssutil = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const io = __importStar(__nccwpck_require__(7436));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
const tc = __importStar(__nccwpck_require__(7784));
|
||||
const fs = __importStar(__nccwpck_require__(5747));
|
||||
const path = __importStar(__nccwpck_require__(5622));
|
||||
const ToolName = 'ossutil';
|
||||
const DownloadEndpoint = 'https://gosspublic.alicdn.com/ossutil';
|
||||
/**
|
||||
@@ -83,6 +85,14 @@ function downloadOssutil(version) {
|
||||
throw error;
|
||||
}
|
||||
core.debug(`ossutil downloaded to: ${toolFile}`);
|
||||
// extract (if needed)
|
||||
if (process.platform === 'win32') {
|
||||
const zipFile = `${toolFile}.zip`;
|
||||
yield io.mv(toolFile, zipFile);
|
||||
const extractFolder = yield tc.extractZip(zipFile);
|
||||
toolFile = path.join(extractFolder, 'ossutil64', 'ossutil64.exe');
|
||||
core.debug(`ossutil extracted to: ${toolFile}`);
|
||||
}
|
||||
// change permission
|
||||
fs.chmodSync(toolFile, 0o755);
|
||||
// cache
|
||||
@@ -104,7 +114,7 @@ function getDownloadUrl(version) {
|
||||
downloadUrl += 'ossutil64';
|
||||
break;
|
||||
case 'win32':
|
||||
downloadUrl += 'ossutil64.exe';
|
||||
downloadUrl += 'ossutil64.zip';
|
||||
break;
|
||||
case 'darwin':
|
||||
downloadUrl += 'ossutilmac64';
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "setup-ossutil",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "setup-ossutil",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-ossutil",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"private": true,
|
||||
"description": "setup ossutil action",
|
||||
"main": "lib/setup-ossutil.js",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as io from '@actions/io'
|
||||
import * as github from '@actions/github'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
const ToolName = 'ossutil'
|
||||
const DownloadEndpoint = 'https://gosspublic.alicdn.com/ossutil'
|
||||
@@ -42,6 +44,15 @@ async function downloadOssutil(version: string): Promise<string> {
|
||||
}
|
||||
core.debug(`ossutil downloaded to: ${toolFile}`)
|
||||
|
||||
// extract (if needed)
|
||||
if (process.platform === 'win32') {
|
||||
const zipFile = `${toolFile}.zip`
|
||||
await io.mv(toolFile, zipFile)
|
||||
const extractFolder = await tc.extractZip(zipFile)
|
||||
toolFile = path.join(extractFolder, 'ossutil64', 'ossutil64.exe')
|
||||
core.debug(`ossutil extracted to: ${toolFile}`)
|
||||
}
|
||||
|
||||
// change permission
|
||||
fs.chmodSync(toolFile, 0o755)
|
||||
|
||||
@@ -64,7 +75,7 @@ function getDownloadUrl(version: string): string {
|
||||
downloadUrl += 'ossutil64'
|
||||
break
|
||||
case 'win32':
|
||||
downloadUrl += 'ossutil64.exe'
|
||||
downloadUrl += 'ossutil64.zip'
|
||||
break
|
||||
case 'darwin':
|
||||
downloadUrl += 'ossutilmac64'
|
||||
|
||||
Reference in New Issue
Block a user