mirror of
https://github.com/subosito/flutter-action.git
synced 2024-08-16 10:19:50 +02:00
update tool-cache 1.1.0
This commit is contained in:
parent
9267b2d4d1
commit
e4b52bc94d
10 changed files with 686 additions and 684 deletions
7
node_modules/@actions/tool-cache/LICENSE.md
generated
vendored
7
node_modules/@actions/tool-cache/LICENSE.md
generated
vendored
|
@ -1,7 +0,0 @@
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
164
node_modules/@actions/tool-cache/README.md
generated
vendored
164
node_modules/@actions/tool-cache/README.md
generated
vendored
|
@ -1,82 +1,82 @@
|
||||||
# `@actions/tool-cache`
|
# `@actions/tool-cache`
|
||||||
|
|
||||||
> Functions necessary for downloading and caching tools.
|
> Functions necessary for downloading and caching tools.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
#### Download
|
#### Download
|
||||||
|
|
||||||
You can use this to download tools (or other files) from a download URL:
|
You can use this to download tools (or other files) from a download URL:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Extract
|
#### Extract
|
||||||
|
|
||||||
These can then be extracted in platform specific ways:
|
These can then be extracted in platform specific ways:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
|
tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
|
||||||
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
|
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
|
||||||
|
|
||||||
// Or alternately
|
// Or alternately
|
||||||
tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
||||||
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Cache
|
#### Cache
|
||||||
|
|
||||||
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for private runners (private runners are still in development but are on the roadmap).
|
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for private runners (private runners are still in development but are on the roadmap).
|
||||||
|
|
||||||
You'll often want to add it to the path as part of this step:
|
You'll often want to add it to the path as part of this step:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||||
|
|
||||||
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
||||||
core.addPath(cachedPath);
|
core.addPath(cachedPath);
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also cache files for reuse.
|
You can also cache files for reuse.
|
||||||
|
|
||||||
```
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
|
tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Find
|
#### Find
|
||||||
|
|
||||||
Finally, you can find directories and files you've previously cached:
|
Finally, you can find directories and files you've previously cached:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const nodeDirectory = tc.find('node', '12.x', 'x64');
|
const nodeDirectory = tc.find('node', '12.x', 'x64');
|
||||||
core.addPath(nodeDirectory);
|
core.addPath(nodeDirectory);
|
||||||
```
|
```
|
||||||
|
|
||||||
You can even find all cached versions of a tool:
|
You can even find all cached versions of a tool:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
const allNodeVersions = tc.findAllVersions('node');
|
const allNodeVersions = tc.findAllVersions('node');
|
||||||
console.log(`Versions of node available: ${allNodeVersions}`);
|
console.log(`Versions of node available: ${allNodeVersions}`);
|
||||||
```
|
```
|
||||||
|
|
157
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
157
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
|
@ -1,78 +1,79 @@
|
||||||
export declare class HTTPError extends Error {
|
export declare class HTTPError extends Error {
|
||||||
readonly httpStatusCode: number | undefined;
|
readonly httpStatusCode: number | undefined;
|
||||||
constructor(httpStatusCode: number | undefined);
|
constructor(httpStatusCode: number | undefined);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Download a tool from an url and stream it into a file
|
* Download a tool from an url and stream it into a file
|
||||||
*
|
*
|
||||||
* @param url url of tool to download
|
* @param url url of tool to download
|
||||||
* @returns path to downloaded tool
|
* @returns path to downloaded tool
|
||||||
*/
|
*/
|
||||||
export declare function downloadTool(url: string): Promise<string>;
|
export declare function downloadTool(url: string): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* Extract a .7z file
|
* Extract a .7z file
|
||||||
*
|
*
|
||||||
* @param file path to the .7z file
|
* @param file path to the .7z file
|
||||||
* @param dest destination directory. Optional.
|
* @param dest destination directory. Optional.
|
||||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||||
* to 7zr.exe can be pass to this function.
|
* to 7zr.exe can be pass to this function.
|
||||||
* @returns path to the destination directory
|
* @returns path to the destination directory
|
||||||
*/
|
*/
|
||||||
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* Extract a tar
|
* Extract a tar
|
||||||
*
|
*
|
||||||
* @param file path to the tar
|
* @param file path to the tar
|
||||||
* @param dest destination directory. Optional.
|
* @param dest destination directory. Optional.
|
||||||
* @returns path to the destination directory
|
* @param flags flags for the tar. Optional.
|
||||||
*/
|
* @returns path to the destination directory
|
||||||
export declare function extractTar(file: string, dest?: string): Promise<string>;
|
*/
|
||||||
/**
|
export declare function extractTar(file: string, dest?: string, flags?: string): Promise<string>;
|
||||||
* Extract a zip
|
/**
|
||||||
*
|
* Extract a zip
|
||||||
* @param file path to the zip
|
*
|
||||||
* @param dest destination directory. Optional.
|
* @param file path to the zip
|
||||||
* @returns path to the destination directory
|
* @param dest destination directory. Optional.
|
||||||
*/
|
* @returns path to the destination directory
|
||||||
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
*/
|
||||||
/**
|
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
||||||
* Caches a directory and installs it into the tool cacheDir
|
/**
|
||||||
*
|
* Caches a directory and installs it into the tool cacheDir
|
||||||
* @param sourceDir the directory to cache into tools
|
*
|
||||||
* @param tool tool name
|
* @param sourceDir the directory to cache into tools
|
||||||
* @param version version of the tool. semver format
|
* @param tool tool name
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
* @param version version of the tool. semver format
|
||||||
*/
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
*/
|
||||||
/**
|
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||||
* Caches a downloaded file (GUID) and installs it
|
/**
|
||||||
* into the tool cache with a given targetName
|
* Caches a downloaded file (GUID) and installs it
|
||||||
*
|
* into the tool cache with a given targetName
|
||||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
*
|
||||||
* @param targetFile the name of the file name in the tools directory
|
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||||
* @param tool tool name
|
* @param targetFile the name of the file name in the tools directory
|
||||||
* @param version version of the tool. semver format
|
* @param tool tool name
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
* @param version version of the tool. semver format
|
||||||
*/
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
*/
|
||||||
/**
|
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||||
* Finds the path to a tool version in the local installed tool cache
|
/**
|
||||||
*
|
* Finds the path to a tool version in the local installed tool cache
|
||||||
* @param toolName name of the tool
|
*
|
||||||
* @param versionSpec version of the tool
|
* @param toolName name of the tool
|
||||||
* @param arch optional arch. defaults to arch of computer
|
* @param versionSpec version of the tool
|
||||||
*/
|
* @param arch optional arch. defaults to arch of computer
|
||||||
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
*/
|
||||||
/**
|
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
||||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
/**
|
||||||
*
|
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||||
* @param toolName name of the tool
|
*
|
||||||
* @param arch optional arch. defaults to arch of computer
|
* @param toolName name of the tool
|
||||||
*/
|
* @param arch optional arch. defaults to arch of computer
|
||||||
export declare function findAllVersions(toolName: string, arch?: string): string[];
|
*/
|
||||||
|
export declare function findAllVersions(toolName: string, arch?: string): string[];
|
||||||
|
|
882
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
882
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
|
@ -1,436 +1,448 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const io = require("@actions/io");
|
const io = require("@actions/io");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const httpm = require("typed-rest-client/HttpClient");
|
const httpm = require("typed-rest-client/HttpClient");
|
||||||
const semver = require("semver");
|
const semver = require("semver");
|
||||||
const uuidV4 = require("uuid/v4");
|
const uuidV4 = require("uuid/v4");
|
||||||
const exec_1 = require("@actions/exec/lib/exec");
|
const exec_1 = require("@actions/exec/lib/exec");
|
||||||
const assert_1 = require("assert");
|
const assert_1 = require("assert");
|
||||||
class HTTPError extends Error {
|
class HTTPError extends Error {
|
||||||
constructor(httpStatusCode) {
|
constructor(httpStatusCode) {
|
||||||
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
||||||
this.httpStatusCode = httpStatusCode;
|
this.httpStatusCode = httpStatusCode;
|
||||||
Object.setPrototypeOf(this, new.target.prototype);
|
Object.setPrototypeOf(this, new.target.prototype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.HTTPError = HTTPError;
|
exports.HTTPError = HTTPError;
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const userAgent = 'actions/tool-cache';
|
const userAgent = 'actions/tool-cache';
|
||||||
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
|
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
|
||||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||||
let cacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
|
let cacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||||
// If directories not found, place them in common temp locations
|
// If directories not found, place them in common temp locations
|
||||||
if (!tempDirectory || !cacheRoot) {
|
if (!tempDirectory || !cacheRoot) {
|
||||||
let baseLocation;
|
let baseLocation;
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// On windows use the USERPROFILE env variable
|
// On windows use the USERPROFILE env variable
|
||||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
baseLocation = '/Users';
|
baseLocation = '/Users';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
baseLocation = '/home';
|
baseLocation = '/home';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempDirectory) {
|
if (!tempDirectory) {
|
||||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||||
}
|
}
|
||||||
if (!cacheRoot) {
|
if (!cacheRoot) {
|
||||||
cacheRoot = path.join(baseLocation, 'actions', 'cache');
|
cacheRoot = path.join(baseLocation, 'actions', 'cache');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Download a tool from an url and stream it into a file
|
* Download a tool from an url and stream it into a file
|
||||||
*
|
*
|
||||||
* @param url url of tool to download
|
* @param url url of tool to download
|
||||||
* @returns path to downloaded tool
|
* @returns path to downloaded tool
|
||||||
*/
|
*/
|
||||||
function downloadTool(url) {
|
function downloadTool(url) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Wrap in a promise so that we can resolve from within stream callbacks
|
// Wrap in a promise so that we can resolve from within stream callbacks
|
||||||
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const http = new httpm.HttpClient(userAgent, [], {
|
const http = new httpm.HttpClient(userAgent, [], {
|
||||||
allowRetries: true,
|
allowRetries: true,
|
||||||
maxRetries: 3
|
maxRetries: 3
|
||||||
});
|
});
|
||||||
const destPath = path.join(tempDirectory, uuidV4());
|
const destPath = path.join(tempDirectory, uuidV4());
|
||||||
yield io.mkdirP(tempDirectory);
|
yield io.mkdirP(tempDirectory);
|
||||||
core.debug(`Downloading ${url}`);
|
core.debug(`Downloading ${url}`);
|
||||||
core.debug(`Downloading ${destPath}`);
|
core.debug(`Downloading ${destPath}`);
|
||||||
if (fs.existsSync(destPath)) {
|
if (fs.existsSync(destPath)) {
|
||||||
throw new Error(`Destination file path ${destPath} already exists`);
|
throw new Error(`Destination file path ${destPath} already exists`);
|
||||||
}
|
}
|
||||||
const response = yield http.get(url);
|
const response = yield http.get(url);
|
||||||
if (response.message.statusCode !== 200) {
|
if (response.message.statusCode !== 200) {
|
||||||
const err = new HTTPError(response.message.statusCode);
|
const err = new HTTPError(response.message.statusCode);
|
||||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
const file = fs.createWriteStream(destPath);
|
const file = fs.createWriteStream(destPath);
|
||||||
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
|
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const stream = response.message.pipe(file);
|
const stream = response.message.pipe(file);
|
||||||
stream.on('close', () => {
|
stream.on('close', () => {
|
||||||
core.debug('download complete');
|
core.debug('download complete');
|
||||||
resolve(destPath);
|
resolve(destPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
file.on('error', err => {
|
file.on('error', err => {
|
||||||
file.end();
|
file.end();
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadTool = downloadTool;
|
exports.downloadTool = downloadTool;
|
||||||
/**
|
/**
|
||||||
* Extract a .7z file
|
* Extract a .7z file
|
||||||
*
|
*
|
||||||
* @param file path to the .7z file
|
* @param file path to the .7z file
|
||||||
* @param dest destination directory. Optional.
|
* @param dest destination directory. Optional.
|
||||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||||
* to 7zr.exe can be pass to this function.
|
* to 7zr.exe can be pass to this function.
|
||||||
* @returns path to the destination directory
|
* @returns path to the destination directory
|
||||||
*/
|
*/
|
||||||
function extract7z(file, dest, _7zPath) {
|
function extract7z(file, dest, _7zPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
||||||
assert_1.ok(file, 'parameter "file" is required');
|
assert_1.ok(file, 'parameter "file" is required');
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
dest = dest || (yield _createExtractFolder(dest));
|
||||||
const originalCwd = process.cwd();
|
const originalCwd = process.cwd();
|
||||||
process.chdir(dest);
|
process.chdir(dest);
|
||||||
if (_7zPath) {
|
if (_7zPath) {
|
||||||
try {
|
try {
|
||||||
const args = [
|
const args = [
|
||||||
'x',
|
'x',
|
||||||
'-bb1',
|
'-bb1',
|
||||||
'-bd',
|
'-bd',
|
||||||
'-sccUTF-8',
|
'-sccUTF-8',
|
||||||
file
|
file
|
||||||
];
|
];
|
||||||
const options = {
|
const options = {
|
||||||
silent: true
|
silent: true
|
||||||
};
|
};
|
||||||
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
process.chdir(originalCwd);
|
process.chdir(originalCwd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const escapedScript = path
|
const escapedScript = path
|
||||||
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
||||||
.replace(/'/g, "''")
|
.replace(/'/g, "''")
|
||||||
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
||||||
const args = [
|
const args = [
|
||||||
'-NoLogo',
|
'-NoLogo',
|
||||||
'-Sta',
|
'-Sta',
|
||||||
'-NoProfile',
|
'-NoProfile',
|
||||||
'-NonInteractive',
|
'-NonInteractive',
|
||||||
'-ExecutionPolicy',
|
'-ExecutionPolicy',
|
||||||
'Unrestricted',
|
'Unrestricted',
|
||||||
'-Command',
|
'-Command',
|
||||||
command
|
command
|
||||||
];
|
];
|
||||||
const options = {
|
const options = {
|
||||||
silent: true
|
silent: true
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const powershellPath = yield io.which('powershell', true);
|
const powershellPath = yield io.which('powershell', true);
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
process.chdir(originalCwd);
|
process.chdir(originalCwd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.extract7z = extract7z;
|
exports.extract7z = extract7z;
|
||||||
/**
|
/**
|
||||||
* Extract a tar
|
* Extract a tar
|
||||||
*
|
*
|
||||||
* @param file path to the tar
|
* @param file path to the tar
|
||||||
* @param dest destination directory. Optional.
|
* @param dest destination directory. Optional.
|
||||||
* @returns path to the destination directory
|
* @param flags flags for the tar. Optional.
|
||||||
*/
|
* @returns path to the destination directory
|
||||||
function extractTar(file, dest) {
|
*/
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
function extractTar(file, dest, flags = 'xz') {
|
||||||
if (!file) {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
throw new Error("parameter 'file' is required");
|
if (!file) {
|
||||||
}
|
throw new Error("parameter 'file' is required");
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
}
|
||||||
const tarPath = yield io.which('tar', true);
|
dest = dest || (yield _createExtractFolder(dest));
|
||||||
yield exec_1.exec(`"${tarPath}"`, ['xzC', dest, '-f', file]);
|
const tarPath = yield io.which('tar', true);
|
||||||
return dest;
|
yield exec_1.exec(`"${tarPath}"`, [flags, '-C', dest, '-f', file]);
|
||||||
});
|
return dest;
|
||||||
}
|
});
|
||||||
exports.extractTar = extractTar;
|
}
|
||||||
/**
|
exports.extractTar = extractTar;
|
||||||
* Extract a zip
|
/**
|
||||||
*
|
* Extract a zip
|
||||||
* @param file path to the zip
|
*
|
||||||
* @param dest destination directory. Optional.
|
* @param file path to the zip
|
||||||
* @returns path to the destination directory
|
* @param dest destination directory. Optional.
|
||||||
*/
|
* @returns path to the destination directory
|
||||||
function extractZip(file, dest) {
|
*/
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
function extractZip(file, dest) {
|
||||||
if (!file) {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
throw new Error("parameter 'file' is required");
|
if (!file) {
|
||||||
}
|
throw new Error("parameter 'file' is required");
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
}
|
||||||
if (IS_WINDOWS) {
|
dest = dest || (yield _createExtractFolder(dest));
|
||||||
yield extractZipWin(file, dest);
|
if (IS_WINDOWS) {
|
||||||
}
|
yield extractZipWin(file, dest);
|
||||||
else {
|
}
|
||||||
yield extractZipNix(file, dest);
|
else {
|
||||||
}
|
if (process.platform === 'darwin') {
|
||||||
return dest;
|
yield extractZipDarwin(file, dest);
|
||||||
});
|
}
|
||||||
}
|
else {
|
||||||
exports.extractZip = extractZip;
|
yield extractZipNix(file, dest);
|
||||||
function extractZipWin(file, dest) {
|
}
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
}
|
||||||
// build the powershell command
|
return dest;
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
});
|
||||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
}
|
||||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
exports.extractZip = extractZip;
|
||||||
// run powershell
|
function extractZipWin(file, dest) {
|
||||||
const powershellPath = yield io.which('powershell');
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = [
|
// build the powershell command
|
||||||
'-NoLogo',
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
'-Sta',
|
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
'-NoProfile',
|
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||||
'-NonInteractive',
|
// run powershell
|
||||||
'-ExecutionPolicy',
|
const powershellPath = yield io.which('powershell');
|
||||||
'Unrestricted',
|
const args = [
|
||||||
'-Command',
|
'-NoLogo',
|
||||||
command
|
'-Sta',
|
||||||
];
|
'-NoProfile',
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
'-NonInteractive',
|
||||||
});
|
'-ExecutionPolicy',
|
||||||
}
|
'Unrestricted',
|
||||||
function extractZipNix(file, dest) {
|
'-Command',
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
command
|
||||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
];
|
||||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
function extractZipNix(file, dest) {
|
||||||
* Caches a directory and installs it into the tool cacheDir
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
*
|
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
||||||
* @param sourceDir the directory to cache into tools
|
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||||
* @param tool tool name
|
});
|
||||||
* @param version version of the tool. semver format
|
}
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
function extractZipDarwin(file, dest) {
|
||||||
*/
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
function cacheDir(sourceDir, tool, version, arch) {
|
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||||
version = semver.clean(version) || version;
|
});
|
||||||
arch = arch || os.arch();
|
}
|
||||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
/**
|
||||||
core.debug(`source dir: ${sourceDir}`);
|
* Caches a directory and installs it into the tool cacheDir
|
||||||
if (!fs.statSync(sourceDir).isDirectory()) {
|
*
|
||||||
throw new Error('sourceDir is not a directory');
|
* @param sourceDir the directory to cache into tools
|
||||||
}
|
* @param tool tool name
|
||||||
// Create the tool dir
|
* @param version version of the tool. semver format
|
||||||
const destPath = yield _createToolPath(tool, version, arch);
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
// copy each child item. do not move. move can fail on Windows
|
*/
|
||||||
// due to anti-virus software having an open handle on a file.
|
function cacheDir(sourceDir, tool, version, arch) {
|
||||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const s = path.join(sourceDir, itemName);
|
version = semver.clean(version) || version;
|
||||||
yield io.cp(s, destPath, { recursive: true });
|
arch = arch || os.arch();
|
||||||
}
|
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||||
// write .complete
|
core.debug(`source dir: ${sourceDir}`);
|
||||||
_completeToolPath(tool, version, arch);
|
if (!fs.statSync(sourceDir).isDirectory()) {
|
||||||
return destPath;
|
throw new Error('sourceDir is not a directory');
|
||||||
});
|
}
|
||||||
}
|
// Create the tool dir
|
||||||
exports.cacheDir = cacheDir;
|
const destPath = yield _createToolPath(tool, version, arch);
|
||||||
/**
|
// copy each child item. do not move. move can fail on Windows
|
||||||
* Caches a downloaded file (GUID) and installs it
|
// due to anti-virus software having an open handle on a file.
|
||||||
* into the tool cache with a given targetName
|
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||||
*
|
const s = path.join(sourceDir, itemName);
|
||||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
yield io.cp(s, destPath, { recursive: true });
|
||||||
* @param targetFile the name of the file name in the tools directory
|
}
|
||||||
* @param tool tool name
|
// write .complete
|
||||||
* @param version version of the tool. semver format
|
_completeToolPath(tool, version, arch);
|
||||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
return destPath;
|
||||||
*/
|
});
|
||||||
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
}
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
exports.cacheDir = cacheDir;
|
||||||
version = semver.clean(version) || version;
|
/**
|
||||||
arch = arch || os.arch();
|
* Caches a downloaded file (GUID) and installs it
|
||||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
* into the tool cache with a given targetName
|
||||||
core.debug(`source file: ${sourceFile}`);
|
*
|
||||||
if (!fs.statSync(sourceFile).isFile()) {
|
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||||
throw new Error('sourceFile is not a file');
|
* @param targetFile the name of the file name in the tools directory
|
||||||
}
|
* @param tool tool name
|
||||||
// create the tool dir
|
* @param version version of the tool. semver format
|
||||||
const destFolder = yield _createToolPath(tool, version, arch);
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
// copy instead of move. move can fail on Windows due to
|
*/
|
||||||
// anti-virus software having an open handle on a file.
|
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
||||||
const destPath = path.join(destFolder, targetFile);
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.debug(`destination file ${destPath}`);
|
version = semver.clean(version) || version;
|
||||||
yield io.cp(sourceFile, destPath);
|
arch = arch || os.arch();
|
||||||
// write .complete
|
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||||
_completeToolPath(tool, version, arch);
|
core.debug(`source file: ${sourceFile}`);
|
||||||
return destFolder;
|
if (!fs.statSync(sourceFile).isFile()) {
|
||||||
});
|
throw new Error('sourceFile is not a file');
|
||||||
}
|
}
|
||||||
exports.cacheFile = cacheFile;
|
// create the tool dir
|
||||||
/**
|
const destFolder = yield _createToolPath(tool, version, arch);
|
||||||
* Finds the path to a tool version in the local installed tool cache
|
// copy instead of move. move can fail on Windows due to
|
||||||
*
|
// anti-virus software having an open handle on a file.
|
||||||
* @param toolName name of the tool
|
const destPath = path.join(destFolder, targetFile);
|
||||||
* @param versionSpec version of the tool
|
core.debug(`destination file ${destPath}`);
|
||||||
* @param arch optional arch. defaults to arch of computer
|
yield io.cp(sourceFile, destPath);
|
||||||
*/
|
// write .complete
|
||||||
function find(toolName, versionSpec, arch) {
|
_completeToolPath(tool, version, arch);
|
||||||
if (!toolName) {
|
return destFolder;
|
||||||
throw new Error('toolName parameter is required');
|
});
|
||||||
}
|
}
|
||||||
if (!versionSpec) {
|
exports.cacheFile = cacheFile;
|
||||||
throw new Error('versionSpec parameter is required');
|
/**
|
||||||
}
|
* Finds the path to a tool version in the local installed tool cache
|
||||||
arch = arch || os.arch();
|
*
|
||||||
// attempt to resolve an explicit version
|
* @param toolName name of the tool
|
||||||
if (!_isExplicitVersion(versionSpec)) {
|
* @param versionSpec version of the tool
|
||||||
const localVersions = findAllVersions(toolName, arch);
|
* @param arch optional arch. defaults to arch of computer
|
||||||
const match = _evaluateVersions(localVersions, versionSpec);
|
*/
|
||||||
versionSpec = match;
|
function find(toolName, versionSpec, arch) {
|
||||||
}
|
if (!toolName) {
|
||||||
// check for the explicit version in the cache
|
throw new Error('toolName parameter is required');
|
||||||
let toolPath = '';
|
}
|
||||||
if (versionSpec) {
|
if (!versionSpec) {
|
||||||
versionSpec = semver.clean(versionSpec) || '';
|
throw new Error('versionSpec parameter is required');
|
||||||
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
|
}
|
||||||
core.debug(`checking cache: ${cachePath}`);
|
arch = arch || os.arch();
|
||||||
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
// attempt to resolve an explicit version
|
||||||
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
if (!_isExplicitVersion(versionSpec)) {
|
||||||
toolPath = cachePath;
|
const localVersions = findAllVersions(toolName, arch);
|
||||||
}
|
const match = _evaluateVersions(localVersions, versionSpec);
|
||||||
else {
|
versionSpec = match;
|
||||||
core.debug('not found');
|
}
|
||||||
}
|
// check for the explicit version in the cache
|
||||||
}
|
let toolPath = '';
|
||||||
return toolPath;
|
if (versionSpec) {
|
||||||
}
|
versionSpec = semver.clean(versionSpec) || '';
|
||||||
exports.find = find;
|
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
|
||||||
/**
|
core.debug(`checking cache: ${cachePath}`);
|
||||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
||||||
*
|
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
||||||
* @param toolName name of the tool
|
toolPath = cachePath;
|
||||||
* @param arch optional arch. defaults to arch of computer
|
}
|
||||||
*/
|
else {
|
||||||
function findAllVersions(toolName, arch) {
|
core.debug('not found');
|
||||||
const versions = [];
|
}
|
||||||
arch = arch || os.arch();
|
}
|
||||||
const toolPath = path.join(cacheRoot, toolName);
|
return toolPath;
|
||||||
if (fs.existsSync(toolPath)) {
|
}
|
||||||
const children = fs.readdirSync(toolPath);
|
exports.find = find;
|
||||||
for (const child of children) {
|
/**
|
||||||
if (_isExplicitVersion(child)) {
|
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||||
const fullPath = path.join(toolPath, child, arch || '');
|
*
|
||||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
* @param toolName name of the tool
|
||||||
versions.push(child);
|
* @param arch optional arch. defaults to arch of computer
|
||||||
}
|
*/
|
||||||
}
|
function findAllVersions(toolName, arch) {
|
||||||
}
|
const versions = [];
|
||||||
}
|
arch = arch || os.arch();
|
||||||
return versions;
|
const toolPath = path.join(cacheRoot, toolName);
|
||||||
}
|
if (fs.existsSync(toolPath)) {
|
||||||
exports.findAllVersions = findAllVersions;
|
const children = fs.readdirSync(toolPath);
|
||||||
function _createExtractFolder(dest) {
|
for (const child of children) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (_isExplicitVersion(child)) {
|
||||||
if (!dest) {
|
const fullPath = path.join(toolPath, child, arch || '');
|
||||||
// create a temp dir
|
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||||
dest = path.join(tempDirectory, uuidV4());
|
versions.push(child);
|
||||||
}
|
}
|
||||||
yield io.mkdirP(dest);
|
}
|
||||||
return dest;
|
}
|
||||||
});
|
}
|
||||||
}
|
return versions;
|
||||||
function _createToolPath(tool, version, arch) {
|
}
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
exports.findAllVersions = findAllVersions;
|
||||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
function _createExtractFolder(dest) {
|
||||||
core.debug(`destination ${folderPath}`);
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const markerPath = `${folderPath}.complete`;
|
if (!dest) {
|
||||||
yield io.rmRF(folderPath);
|
// create a temp dir
|
||||||
yield io.rmRF(markerPath);
|
dest = path.join(tempDirectory, uuidV4());
|
||||||
yield io.mkdirP(folderPath);
|
}
|
||||||
return folderPath;
|
yield io.mkdirP(dest);
|
||||||
});
|
return dest;
|
||||||
}
|
});
|
||||||
function _completeToolPath(tool, version, arch) {
|
}
|
||||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
function _createToolPath(tool, version, arch) {
|
||||||
const markerPath = `${folderPath}.complete`;
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
fs.writeFileSync(markerPath, '');
|
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||||
core.debug('finished caching tool');
|
core.debug(`destination ${folderPath}`);
|
||||||
}
|
const markerPath = `${folderPath}.complete`;
|
||||||
function _isExplicitVersion(versionSpec) {
|
yield io.rmRF(folderPath);
|
||||||
const c = semver.clean(versionSpec) || '';
|
yield io.rmRF(markerPath);
|
||||||
core.debug(`isExplicit: ${c}`);
|
yield io.mkdirP(folderPath);
|
||||||
const valid = semver.valid(c) != null;
|
return folderPath;
|
||||||
core.debug(`explicit? ${valid}`);
|
});
|
||||||
return valid;
|
}
|
||||||
}
|
function _completeToolPath(tool, version, arch) {
|
||||||
function _evaluateVersions(versions, versionSpec) {
|
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||||
let version = '';
|
const markerPath = `${folderPath}.complete`;
|
||||||
core.debug(`evaluating ${versions.length} versions`);
|
fs.writeFileSync(markerPath, '');
|
||||||
versions = versions.sort((a, b) => {
|
core.debug('finished caching tool');
|
||||||
if (semver.gt(a, b)) {
|
}
|
||||||
return 1;
|
function _isExplicitVersion(versionSpec) {
|
||||||
}
|
const c = semver.clean(versionSpec) || '';
|
||||||
return -1;
|
core.debug(`isExplicit: ${c}`);
|
||||||
});
|
const valid = semver.valid(c) != null;
|
||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
core.debug(`explicit? ${valid}`);
|
||||||
const potential = versions[i];
|
return valid;
|
||||||
const satisfied = semver.satisfies(potential, versionSpec);
|
}
|
||||||
if (satisfied) {
|
function _evaluateVersions(versions, versionSpec) {
|
||||||
version = potential;
|
let version = '';
|
||||||
break;
|
core.debug(`evaluating ${versions.length} versions`);
|
||||||
}
|
versions = versions.sort((a, b) => {
|
||||||
}
|
if (semver.gt(a, b)) {
|
||||||
if (version) {
|
return 1;
|
||||||
core.debug(`matched: ${version}`);
|
}
|
||||||
}
|
return -1;
|
||||||
else {
|
});
|
||||||
core.debug('match not found');
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
}
|
const potential = versions[i];
|
||||||
return version;
|
const satisfied = semver.satisfies(potential, versionSpec);
|
||||||
}
|
if (satisfied) {
|
||||||
|
version = potential;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version) {
|
||||||
|
core.debug(`matched: ${version}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug('match not found');
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
//# sourceMappingURL=tool-cache.js.map
|
//# sourceMappingURL=tool-cache.js.map
|
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
File diff suppressed because one or more lines are too long
32
node_modules/@actions/tool-cache/package.json
generated
vendored
32
node_modules/@actions/tool-cache/package.json
generated
vendored
|
@ -1,36 +1,32 @@
|
||||||
{
|
{
|
||||||
"_args": [
|
"_from": "@actions/tool-cache@^1.1.0",
|
||||||
[
|
"_id": "@actions/tool-cache@1.1.0",
|
||||||
"@actions/tool-cache@1.0.0",
|
|
||||||
"/Users/subosito/Code/playground/flutter-actions"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "@actions/tool-cache@1.0.0",
|
|
||||||
"_id": "@actions/tool-cache@1.0.0",
|
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
|
"_integrity": "sha512-Oe/R1Gxv0G699OUL9ypxk9cTwHf1uXHhpcK7kpZt8d/Sbw915ktMkfxXt9+awOfLDwyl54sLi86KGCuSvnRuIQ==",
|
||||||
"_location": "/@actions/tool-cache",
|
"_location": "/@actions/tool-cache",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "range",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@actions/tool-cache@1.0.0",
|
"raw": "@actions/tool-cache@^1.1.0",
|
||||||
"name": "@actions/tool-cache",
|
"name": "@actions/tool-cache",
|
||||||
"escapedName": "@actions%2ftool-cache",
|
"escapedName": "@actions%2ftool-cache",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "1.0.0",
|
"rawSpec": "^1.1.0",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "1.0.0"
|
"fetchSpec": "^1.1.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/"
|
"/"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.0.tgz",
|
||||||
"_spec": "1.0.0",
|
"_shasum": "1a0e29f244f2b5c6989fc264581068689f9c219e",
|
||||||
"_where": "/Users/subosito/Code/playground/flutter-actions",
|
"_spec": "@actions/tool-cache@^1.1.0",
|
||||||
|
"_where": "/Users/subosito/Code/subosito/flutter-action",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.0.0",
|
"@actions/core": "^1.0.0",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.0.0",
|
||||||
|
@ -39,6 +35,7 @@
|
||||||
"typed-rest-client": "^1.4.0",
|
"typed-rest-client": "^1.4.0",
|
||||||
"uuid": "^3.3.2"
|
"uuid": "^3.3.2"
|
||||||
},
|
},
|
||||||
|
"deprecated": false,
|
||||||
"description": "Actions tool-cache lib",
|
"description": "Actions tool-cache lib",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/nock": "^10.0.3",
|
"@types/nock": "^10.0.3",
|
||||||
|
@ -54,7 +51,6 @@
|
||||||
"lib",
|
"lib",
|
||||||
"scripts"
|
"scripts"
|
||||||
],
|
],
|
||||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"exec",
|
"exec",
|
||||||
|
@ -74,5 +70,5 @@
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "1.0.0"
|
"version": "1.1.0"
|
||||||
}
|
}
|
||||||
|
|
118
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
118
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
|
@ -1,60 +1,60 @@
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$Source,
|
[string]$Source,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$Target)
|
[string]$Target)
|
||||||
|
|
||||||
# This script translates the output from 7zdec into UTF8. Node has limited
|
# This script translates the output from 7zdec into UTF8. Node has limited
|
||||||
# built-in support for encodings.
|
# built-in support for encodings.
|
||||||
#
|
#
|
||||||
# 7zdec uses the system default code page. The system default code page varies
|
# 7zdec uses the system default code page. The system default code page varies
|
||||||
# depending on the locale configuration. On an en-US box, the system default code
|
# depending on the locale configuration. On an en-US box, the system default code
|
||||||
# page is Windows-1252.
|
# page is Windows-1252.
|
||||||
#
|
#
|
||||||
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
||||||
# determine whether data is passed correctly between processes. This is because
|
# determine whether data is passed correctly between processes. This is because
|
||||||
# the 'ç' character has a different code point across each of the common encodings
|
# the 'ç' character has a different code point across each of the common encodings
|
||||||
# on a typical en-US box, i.e.
|
# on a typical en-US box, i.e.
|
||||||
# 1) the default console-output code page (IBM437)
|
# 1) the default console-output code page (IBM437)
|
||||||
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
||||||
# 3) UTF8
|
# 3) UTF8
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
||||||
$stdout = [System.Console]::OpenStandardOutput()
|
$stdout = [System.Console]::OpenStandardOutput()
|
||||||
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
||||||
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
||||||
[System.Console]::SetOut($writer)
|
[System.Console]::SetOut($writer)
|
||||||
|
|
||||||
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
||||||
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
||||||
|
|
||||||
Set-Location -LiteralPath $Target
|
Set-Location -LiteralPath $Target
|
||||||
|
|
||||||
# Print the ##command.
|
# Print the ##command.
|
||||||
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
||||||
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
||||||
|
|
||||||
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
||||||
# from the external command.
|
# from the external command.
|
||||||
$OutputEncoding = [System.Text.Encoding]::Default
|
$OutputEncoding = [System.Text.Encoding]::Default
|
||||||
|
|
||||||
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
||||||
# will launch the external command in such a way that it inherits the streams.
|
# will launch the external command in such a way that it inherits the streams.
|
||||||
& $_7zdec x $Source 2>&1 |
|
& $_7zdec x $Source 2>&1 |
|
||||||
ForEach-Object {
|
ForEach-Object {
|
||||||
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
||||||
[System.Console]::WriteLine($_.Exception.Message)
|
[System.Console]::WriteLine($_.Exception.Message)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[System.Console]::WriteLine($_)
|
[System.Console]::WriteLine($_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
||||||
[System.Console]::Out.Flush()
|
[System.Console]::Out.Flush()
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
}
|
}
|
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip-darwin
generated
vendored
Executable file
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip-darwin
generated
vendored
Executable file
Binary file not shown.
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -20,9 +20,9 @@
|
||||||
"integrity": "sha512-ezrJSRdqtXtdx1WXlfYL85+40F7gB39jCK9P0jZVODW3W6xUYmu6ZOEc/UmmElUwhRyDRm1R4yNZu1Joq2kuQg=="
|
"integrity": "sha512-ezrJSRdqtXtdx1WXlfYL85+40F7gB39jCK9P0jZVODW3W6xUYmu6ZOEc/UmmElUwhRyDRm1R4yNZu1Joq2kuQg=="
|
||||||
},
|
},
|
||||||
"@actions/tool-cache": {
|
"@actions/tool-cache": {
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.0.tgz",
|
||||||
"integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
|
"integrity": "sha512-Oe/R1Gxv0G699OUL9ypxk9cTwHf1uXHhpcK7kpZt8d/Sbw915ktMkfxXt9+awOfLDwyl54sLi86KGCuSvnRuIQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.0.0",
|
"@actions/core": "^1.0.0",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.0.0",
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"@actions/core": "^1.0.0",
|
"@actions/core": "^1.0.0",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.0.0",
|
||||||
"@actions/io": "^1.0.0",
|
"@actions/io": "^1.0.0",
|
||||||
"@actions/tool-cache": "^1.0.0",
|
"@actions/tool-cache": "^1.1.0",
|
||||||
"semver": "^6.3.0",
|
"semver": "^6.3.0",
|
||||||
"uuid": "^3.3.2"
|
"uuid": "^3.3.2"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue