mirror of
https://github.com/subosito/flutter-action.git
synced 2024-08-16 10:19:50 +02:00
commit
8f119fb49d
12 changed files with 690 additions and 780 deletions
|
@ -14,9 +14,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
|
@ -25,8 +22,6 @@ const fs = __importStar(require("fs"));
|
|||
const path = __importStar(require("path"));
|
||||
const restm = __importStar(require("typed-rest-client/RestClient"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const v4_1 = __importDefault(require("uuid/v4"));
|
||||
const exec_1 = require("@actions/exec/lib/exec");
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const IS_DARWIN = process.platform === 'darwin';
|
||||
const IS_LINUX = process.platform === 'linux';
|
||||
|
@ -122,50 +117,11 @@ function extractFile(file, destDir) {
|
|||
throw new Error(`Failed to extract ${file} - it is a directory`);
|
||||
}
|
||||
if ('tar.xz' === extName()) {
|
||||
yield extractTarXz(file, destDir);
|
||||
}
|
||||
else {
|
||||
if (IS_DARWIN) {
|
||||
yield extractZipDarwin(file, destDir);
|
||||
yield tc.extractTar(file, destDir, 'x');
|
||||
}
|
||||
else {
|
||||
yield tc.extractZip(file, destDir);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Extract a tar.xz
|
||||
*
|
||||
* @param file path to the tar.xz
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractTarXz(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const tarPath = yield io.which('tar', true);
|
||||
yield exec_1.exec(`"${tarPath}"`, ['xC', dest, '-f', file]);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractTarXz = extractTarXz;
|
||||
function _createExtractFolder(dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!dest) {
|
||||
dest = path.join(tempDirectory, v4_1.default());
|
||||
}
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
function extractZipDarwin(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
function determineVersion(version, channel) {
|
||||
|
|
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.
|
12
node_modules/@actions/tool-cache/README.md
generated
vendored
12
node_modules/@actions/tool-cache/README.md
generated
vendored
|
@ -8,7 +8,7 @@
|
|||
|
||||
You can use this to download tools (or other files) from a download URL:
|
||||
|
||||
```
|
||||
```js
|
||||
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');
|
||||
|
@ -18,7 +18,7 @@ const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v1
|
|||
|
||||
These can then be extracted in platform specific ways:
|
||||
|
||||
```
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
|
@ -41,7 +41,7 @@ Finally, you can cache these directories in our tool-cache. This is useful if yo
|
|||
|
||||
You'll often want to add it to the path as part of this step:
|
||||
|
||||
```
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
const core = require('@actions/core');
|
||||
|
||||
|
@ -54,7 +54,7 @@ core.addPath(cachedPath);
|
|||
|
||||
You can also cache files for reuse.
|
||||
|
||||
```
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
|
||||
|
@ -64,7 +64,7 @@ tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
|
|||
|
||||
Finally, you can find directories and files you've previously cached:
|
||||
|
||||
```
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
const core = require('@actions/core');
|
||||
|
||||
|
@ -74,7 +74,7 @@ core.addPath(nodeDirectory);
|
|||
|
||||
You can even find all cached versions of a tool:
|
||||
|
||||
```
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
const allNodeVersions = tc.findAllVersions('node');
|
||||
|
|
3
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
3
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
|
@ -30,9 +30,10 @@ export declare function extract7z(file: string, dest?: string, _7zPath?: string)
|
|||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @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
|
||||
*
|
||||
|
|
16
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
16
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
|
@ -185,16 +185,17 @@ exports.extract7z = extract7z;
|
|||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @param flags flags for the tar. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractTar(file, dest) {
|
||||
function extractTar(file, dest, flags = 'xz') {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const tarPath = yield io.which('tar', true);
|
||||
yield exec_1.exec(`"${tarPath}"`, ['xzC', dest, '-f', file]);
|
||||
yield exec_1.exec(`"${tarPath}"`, [flags, '-C', dest, '-f', file]);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
|
@ -215,9 +216,14 @@ function extractZip(file, dest) {
|
|||
if (IS_WINDOWS) {
|
||||
yield extractZipWin(file, dest);
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
yield extractZipDarwin(file, dest);
|
||||
}
|
||||
else {
|
||||
yield extractZipNix(file, dest);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
|
@ -249,6 +255,12 @@ function extractZipNix(file, dest) {
|
|||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
function extractZipDarwin(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
|
|
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": [
|
||||
[
|
||||
"@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",
|
||||
"_from": "@actions/tool-cache@^1.1.0",
|
||||
"_id": "@actions/tool-cache@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
|
||||
"_integrity": "sha512-Oe/R1Gxv0G699OUL9ypxk9cTwHf1uXHhpcK7kpZt8d/Sbw915ktMkfxXt9+awOfLDwyl54sLi86KGCuSvnRuIQ==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/tool-cache@1.0.0",
|
||||
"raw": "@actions/tool-cache@^1.1.0",
|
||||
"name": "@actions/tool-cache",
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.0.0",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "/Users/subosito/Code/playground/flutter-actions",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.0.tgz",
|
||||
"_shasum": "1a0e29f244f2b5c6989fc264581068689f9c219e",
|
||||
"_spec": "@actions/tool-cache@^1.1.0",
|
||||
"_where": "/Users/subosito/Code/subosito/flutter-action",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.0.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
|
@ -39,6 +35,7 @@
|
|||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions tool-cache lib",
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
|
@ -54,7 +51,6 @@
|
|||
"lib",
|
||||
"scripts"
|
||||
],
|
||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"exec",
|
||||
|
@ -74,5 +70,5 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
|
|
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=="
|
||||
},
|
||||
"@actions/tool-cache": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.0.0.tgz",
|
||||
"integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.0.tgz",
|
||||
"integrity": "sha512-Oe/R1Gxv0G699OUL9ypxk9cTwHf1uXHhpcK7kpZt8d/Sbw915ktMkfxXt9+awOfLDwyl54sLi86KGCuSvnRuIQ==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.0.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"@actions/core": "^1.0.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"@actions/tool-cache": "^1.0.0",
|
||||
"@actions/tool-cache": "^1.1.0",
|
||||
"semver": "^6.3.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
|
|
|
@ -5,8 +5,6 @@ import * as fs from 'fs';
|
|||
import * as path from 'path';
|
||||
import * as restm from 'typed-rest-client/RestClient';
|
||||
import * as semver from 'semver';
|
||||
import uuidV4 from 'uuid/v4';
|
||||
import {exec} from '@actions/exec/lib/exec';
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const IS_DARWIN = process.platform === 'darwin';
|
||||
|
@ -130,56 +128,10 @@ async function extractFile(file: string, destDir: string): Promise<void> {
|
|||
}
|
||||
|
||||
if ('tar.xz' === extName()) {
|
||||
await extractTarXz(file, destDir);
|
||||
} else {
|
||||
if (IS_DARWIN) {
|
||||
await extractZipDarwin(file, destDir);
|
||||
await tc.extractTar(file, destDir, 'x');
|
||||
} else {
|
||||
await tc.extractZip(file, destDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a tar.xz
|
||||
*
|
||||
* @param file path to the tar.xz
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export async function extractTarXz(
|
||||
file: string,
|
||||
dest?: string
|
||||
): Promise<string> {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
|
||||
dest = dest || (await _createExtractFolder(dest));
|
||||
const tarPath: string = await io.which('tar', true);
|
||||
await exec(`"${tarPath}"`, ['xC', dest, '-f', file]);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
async function _createExtractFolder(dest?: string): Promise<string> {
|
||||
if (!dest) {
|
||||
dest = path.join(tempDirectory, uuidV4());
|
||||
}
|
||||
|
||||
await io.mkdirP(dest);
|
||||
return dest;
|
||||
}
|
||||
|
||||
async function extractZipDarwin(file: string, dest: string): Promise<void> {
|
||||
const unzipPath = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'scripts',
|
||||
'externals',
|
||||
'unzip-darwin'
|
||||
);
|
||||
await exec(`"${unzipPath}"`, [file], {cwd: dest});
|
||||
}
|
||||
|
||||
async function determineVersion(
|
||||
|
|
Loading…
Reference in a new issue