@docker/actions-toolkit 0.1.0-beta.13 → 0.1.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/docker.js +5 -11
- package/lib/docker.js.map +1 -1
- package/lib/index.d.ts +24 -0
- package/lib/index.js +80 -0
- package/lib/index.js.map +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
package/lib/docker.js
CHANGED
|
@@ -54,6 +54,7 @@ exports.Docker = void 0;
|
|
|
54
54
|
const os_1 = __importDefault(require("os"));
|
|
55
55
|
const path_1 = __importDefault(require("path"));
|
|
56
56
|
const core = __importStar(require("@actions/core"));
|
|
57
|
+
const io = __importStar(require("@actions/io"));
|
|
57
58
|
const exec_1 = require("./exec");
|
|
58
59
|
class Docker {
|
|
59
60
|
static get configDir() {
|
|
@@ -61,23 +62,16 @@ class Docker {
|
|
|
61
62
|
}
|
|
62
63
|
static isAvailable() {
|
|
63
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
silent: true
|
|
67
|
-
})
|
|
65
|
+
return yield io
|
|
66
|
+
.which('docker', true)
|
|
68
67
|
.then(res => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return res.exitCode == 0;
|
|
68
|
+
core.debug(`Docker.isAvailable ok: ${res}`);
|
|
69
|
+
return true;
|
|
74
70
|
})
|
|
75
71
|
.catch(error => {
|
|
76
72
|
core.debug(`Docker.isAvailable error: ${error}`);
|
|
77
73
|
return false;
|
|
78
74
|
});
|
|
79
|
-
core.debug(`Docker.isAvailable: ${ok}`);
|
|
80
|
-
return ok;
|
|
81
75
|
});
|
|
82
76
|
}
|
|
83
77
|
static printVersion() {
|
package/lib/docker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../src/docker.ts"],"names":[],"mappings":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,CAAC,CAAC,CAAC;QACzC,CAAC;KAAA;IAEM,MAAM,CAAO,SAAS;;YAC3B,MAAM,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACtC,CAAC;KAAA;CACF;AAzBD,wBAyBC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 actions-toolkit authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Runs a GitHub Action.
|
|
18
|
+
* Output will be streamed to the live console.
|
|
19
|
+
*
|
|
20
|
+
* @param main runs the defined function.
|
|
21
|
+
* @param post runs the defined function at the end of the job if set.
|
|
22
|
+
* @returns Promise<void>
|
|
23
|
+
*/
|
|
24
|
+
export declare function run(main: () => Promise<void>, post?: () => Promise<void>): Promise<void>;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023 actions-toolkit authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.run = void 0;
|
|
51
|
+
const core = __importStar(require("@actions/core"));
|
|
52
|
+
const isPost = !!process.env['STATE_isPost'];
|
|
53
|
+
if (!isPost) {
|
|
54
|
+
core.saveState('isPost', 'true');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Runs a GitHub Action.
|
|
58
|
+
* Output will be streamed to the live console.
|
|
59
|
+
*
|
|
60
|
+
* @param main runs the defined function.
|
|
61
|
+
* @param post runs the defined function at the end of the job if set.
|
|
62
|
+
* @returns Promise<void>
|
|
63
|
+
*/
|
|
64
|
+
function run(main, post) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
if (!isPost) {
|
|
67
|
+
try {
|
|
68
|
+
yield main();
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
core.setFailed(e.message);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (post) {
|
|
75
|
+
yield post();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.run = run;
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC7C,IAAI,CAAC,MAAM,EAAE;IACX,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,SAAsB,GAAG,CAAC,IAAyB,EAAE,IAA0B;;QAC7E,IAAI,CAAC,MAAM,EAAE;YACX,IAAI;gBACF,MAAM,IAAI,EAAE,CAAC;aACd;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;aAC3B;SACF;aAAM,IAAI,IAAI,EAAE;YACf,MAAM,IAAI,EAAE,CAAC;SACd;IACH,CAAC;CAAA;AAVD,kBAUC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docker/actions-toolkit",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.14",
|
|
4
4
|
"description": "Toolkit for Docker (GitHub) Actions",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"author": "Docker Inc.",
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"packageManager": "yarn@3.3.1",
|
|
31
|
-
"main": "lib/
|
|
32
|
-
"types": "lib/
|
|
31
|
+
"main": "lib/index.js",
|
|
32
|
+
"types": "lib/index.d.ts",
|
|
33
33
|
"directories": {
|
|
34
34
|
"lib": "lib",
|
|
35
35
|
"test": "__tests__"
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@actions/exec": "^1.1.1",
|
|
47
47
|
"@actions/github": "^5.1.1",
|
|
48
48
|
"@actions/http-client": "^2.0.1",
|
|
49
|
+
"@actions/io": "^1.1.2",
|
|
49
50
|
"@actions/tool-cache": "^2.0.1",
|
|
50
51
|
"csv-parse": "^5.3.5",
|
|
51
52
|
"jwt-decode": "^3.1.2",
|