fix bin folder
This commit is contained in:
+12
-12
@@ -39,9 +39,9 @@ describe('installer tests', () => {
|
||||
expect(fs.existsSync(`${taskDir}.complete`)).toBe(true);
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(taskDir, 'task.exe'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskDir, 'bin', 'task.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(taskDir, 'task'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskDir, 'bin', 'task'))).toBe(true);
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
@@ -63,33 +63,33 @@ describe('installer tests', () => {
|
||||
|
||||
expect(fs.existsSync(`${taskDir}.complete`)).toBe(true);
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(taskDir, 'task.exe'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskDir, 'bin', 'task.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(taskDir, 'task'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskDir, 'bin', 'task'))).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('Gets latest version of Task using 2.x and no matching version is installed', async () => {
|
||||
await installer.getTask('2.x');
|
||||
const goDir = path.join(toolDir, 'task', '2.6.0', os.arch());
|
||||
const taskdir = path.join(toolDir, 'task', '2.6.0', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(goDir, 'task.exe'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskdir, 'bin', 'task.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(goDir, 'task'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskdir, 'bin', 'task'))).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('Gets preview version of Task using 3.x and no matching version is installed', async () => {
|
||||
await installer.getTask('3.x');
|
||||
const goDir = path.join(toolDir, 'task', '3.0.0-preview1', os.arch());
|
||||
const taskdir = path.join(toolDir, 'task', '3.0.0-preview1', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(goDir, 'task.exe'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskdir, 'bin', 'task.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(goDir, 'task'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(taskdir, 'bin', 'task'))).toBe(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -40,6 +40,7 @@ if (!tempDirectory) {
|
||||
}
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const io = require("@actions/io");
|
||||
let osPlat = os.platform();
|
||||
let osArch = os.arch();
|
||||
function getTask(version) {
|
||||
@@ -79,9 +80,15 @@ function downloadRelease(version) {
|
||||
let extPath = null;
|
||||
if (osPlat == 'win32') {
|
||||
extPath = yield tc.extractZip(downloadPath);
|
||||
// Create a bin/ folder and move `task` there
|
||||
yield io.mkdirP(path.join(extPath, 'bin'));
|
||||
yield io.mv(path.join(extPath, 'task.exe'), path.join(extPath, 'bin'));
|
||||
}
|
||||
else {
|
||||
extPath = yield tc.extractTar(downloadPath);
|
||||
// Create a bin/ folder and move `task` there
|
||||
yield io.mkdirP(path.join(extPath, 'bin'));
|
||||
yield io.mv(path.join(extPath, 'task'), path.join(extPath, 'bin'));
|
||||
}
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
return yield tc.cacheDir(extPath, 'task', version);
|
||||
|
||||
+7
-2
@@ -24,8 +24,7 @@ if (!tempDirectory) {
|
||||
|
||||
import * as core from '@actions/core';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import { Cipher } from 'crypto';
|
||||
import { conditionalExpression } from '@babel/types';
|
||||
import io = require('@actions/io');
|
||||
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = os.arch();
|
||||
@@ -75,8 +74,14 @@ async function downloadRelease(version: string): Promise<string> {
|
||||
let extPath: string | null = null;
|
||||
if (osPlat == 'win32') {
|
||||
extPath = await tc.extractZip(downloadPath);
|
||||
// Create a bin/ folder and move `task` there
|
||||
await io.mkdirP(path.join(extPath, 'bin'))
|
||||
await io.mv(path.join(extPath, 'task.exe'), path.join(extPath, 'bin'))
|
||||
} else {
|
||||
extPath = await tc.extractTar(downloadPath);
|
||||
// Create a bin/ folder and move `task` there
|
||||
await io.mkdirP(path.join(extPath, 'bin'))
|
||||
await io.mv(path.join(extPath, 'task'), path.join(extPath, 'bin'))
|
||||
}
|
||||
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
|
||||
Reference in New Issue
Block a user