@sebbo2002/semantic-release-docker 1.0.0-develop.1 → 1.0.1-develop.2
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/dist/index.d.ts +3 -3
- package/dist/index.js +33 -19
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +19 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Context } from 'semantic-release';
|
|
2
|
-
import { MajorAndMinorPart, NormalizedPluginConfigTags, NormalizedPluginConfig, PluginConfig, PluginConfigTagKeys, TagTask } from './types';
|
|
2
|
+
import { MajorAndMinorPart, NormalizedPluginConfigTags, NormalizedPluginConfig, PluginConfig, PluginConfigTagKeys, TagTask, PublishResponse } from './types';
|
|
3
3
|
export { PluginConfig, NormalizedPluginConfigTags, NormalizedPluginConfig, PluginConfigTagKeys, MajorAndMinorPart, TagTask };
|
|
4
4
|
export declare function parseConfig(config: PluginConfig): NormalizedPluginConfig;
|
|
5
5
|
export declare function getBaseImage(input: string): string;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function isPreRelease(context: Context): boolean;
|
|
7
7
|
export declare function getMajorAndMinorPart(version: string | undefined): MajorAndMinorPart;
|
|
8
8
|
export declare function getTagTasks(config: NormalizedPluginConfig, context: Context): TagTask[];
|
|
9
9
|
export declare function docker(command: string[]): Promise<void>;
|
|
10
10
|
export declare function tagImage(input: string, output: string): Promise<void>;
|
|
11
11
|
export declare function pushImage(image: string): Promise<void>;
|
|
12
|
-
export declare function publish(pluginConfig: PluginConfig, context: Context): Promise<
|
|
12
|
+
export declare function publish(pluginConfig: PluginConfig, context: Context): Promise<boolean | PublishResponse>;
|
|
13
13
|
declare const _default: {
|
|
14
14
|
publish: typeof publish;
|
|
15
15
|
};
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.publish = exports.pushImage = exports.tagImage = exports.docker = exports.getTagTasks = exports.getMajorAndMinorPart = exports.
|
|
15
|
+
exports.publish = exports.pushImage = exports.tagImage = exports.docker = exports.getTagTasks = exports.getMajorAndMinorPart = exports.isPreRelease = exports.getBaseImage = exports.parseConfig = void 0;
|
|
16
16
|
const execa_1 = __importDefault(require("execa"));
|
|
17
17
|
function parseConfig(config) {
|
|
18
18
|
const result = {
|
|
@@ -55,11 +55,10 @@ function getBaseImage(input) {
|
|
|
55
55
|
return p[0];
|
|
56
56
|
}
|
|
57
57
|
exports.getBaseImage = getBaseImage;
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
return ['major', 'minor', 'patch'].includes(String((_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.type));
|
|
58
|
+
function isPreRelease(context) {
|
|
59
|
+
return Boolean(context.nextRelease && context.nextRelease.version.includes('-'));
|
|
61
60
|
}
|
|
62
|
-
exports.
|
|
61
|
+
exports.isPreRelease = isPreRelease;
|
|
63
62
|
function getMajorAndMinorPart(version) {
|
|
64
63
|
if (!version) {
|
|
65
64
|
return {
|
|
@@ -83,7 +82,14 @@ function getTagTasks(config, context) {
|
|
|
83
82
|
config.images.forEach(input => {
|
|
84
83
|
var _a;
|
|
85
84
|
const outputBase = getBaseImage(input);
|
|
86
|
-
|
|
85
|
+
// version
|
|
86
|
+
if (config.tag.version && version) {
|
|
87
|
+
result.push({
|
|
88
|
+
input,
|
|
89
|
+
output: `${outputBase}:${version}`
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (!isPreRelease(context)) {
|
|
87
93
|
const { major, minor } = getMajorAndMinorPart(version);
|
|
88
94
|
// latest
|
|
89
95
|
if (config.tag.latest) {
|
|
@@ -107,17 +113,7 @@ function getTagTasks(config, context) {
|
|
|
107
113
|
});
|
|
108
114
|
}
|
|
109
115
|
}
|
|
110
|
-
// version
|
|
111
|
-
if (config.tag.version && version) {
|
|
112
|
-
result.push({
|
|
113
|
-
input,
|
|
114
|
-
output: `${outputBase}:${version}`
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
116
|
// channel
|
|
118
|
-
// Sadly, channel is not defined in the types…
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
120
|
-
// @ts-ignore
|
|
121
117
|
const channel = (_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.channel;
|
|
122
118
|
if (config.tag.channel && channel) {
|
|
123
119
|
result.push({
|
|
@@ -132,10 +128,17 @@ exports.getTagTasks = getTagTasks;
|
|
|
132
128
|
function docker(command) {
|
|
133
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
130
|
try {
|
|
135
|
-
yield execa_1.default('docker', command);
|
|
131
|
+
yield (0, execa_1.default)('docker', command);
|
|
136
132
|
}
|
|
137
133
|
catch (error) {
|
|
138
|
-
|
|
134
|
+
if (typeof error === 'object' && error !== null && 'command' in error && 'message' in error) {
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
throw new Error(`Unable to run "${error.command}": ${error.message}`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
throw new Error(`Unable to run "${command.join(' ')}": ${error}`);
|
|
141
|
+
}
|
|
139
142
|
}
|
|
140
143
|
});
|
|
141
144
|
}
|
|
@@ -153,19 +156,30 @@ function pushImage(image) {
|
|
|
153
156
|
}
|
|
154
157
|
exports.pushImage = pushImage;
|
|
155
158
|
function publish(pluginConfig, context) {
|
|
159
|
+
var _a;
|
|
156
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
161
|
if (!context.nextRelease) {
|
|
158
162
|
context.logger.log('No release schedules, so no images to tag.');
|
|
159
|
-
return;
|
|
163
|
+
return false;
|
|
160
164
|
}
|
|
161
165
|
const config = parseConfig(pluginConfig);
|
|
162
166
|
const tasks = getTagTasks(config, context);
|
|
167
|
+
if (!tasks.length) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
163
170
|
for (const task of tasks) {
|
|
164
171
|
context.logger.log(`Tag ${task.input} → ${task.output}`);
|
|
165
172
|
yield tagImage(task.input, task.output);
|
|
166
173
|
context.logger.log(`Push ${task.output}`);
|
|
167
174
|
yield pushImage(task.output);
|
|
168
175
|
}
|
|
176
|
+
const channel = (_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.channel;
|
|
177
|
+
const firstTask = tasks[0];
|
|
178
|
+
return {
|
|
179
|
+
name: `Docker container (${firstTask.output})`,
|
|
180
|
+
url: firstTask.output,
|
|
181
|
+
channel
|
|
182
|
+
};
|
|
169
183
|
});
|
|
170
184
|
}
|
|
171
185
|
exports.publish = publish;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,kDAA0B;AAW1B,SAAgB,WAAW,CAAE,MAAoB;IAC7C,MAAM,MAAM,GAA2B;QACnC,MAAM,EAAE,EAAE;QACV,GAAG,EAAE;YACD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SAChB;KACJ,CAAC;IAEF,IAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACrC;SACI,IAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QAClC,MAAM,CAAC,MAAM;aACR,MAAM,CAAC,KAAK,CAAC,EAAE,C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CAAC,MAAM,GAAG;YAC9C,GAAG,EAAE,SAAS,CAAC,MAAM;YACrB,OAAO;SACV,CAAC;;CACL;AA3BD,0BA2BC;AAED,kBAAe;IACX,OAAO;CACV,CAAC"}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "Sebastian Pekarek <
|
|
2
|
+
"author": "Sebastian Pekarek <mail@sebbo.net>",
|
|
3
3
|
"bugs": {
|
|
4
4
|
"url": "https://github.com/sebbo2002/semantic-release-docker/issues"
|
|
5
5
|
},
|
|
@@ -8,27 +8,26 @@
|
|
|
8
8
|
},
|
|
9
9
|
"description": "Plugin for semantic-release that tags a previously built Docker image and pushes it to one or more Docker registries",
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@amanda-mitchell/semantic-release-npm-multiple": "^2.
|
|
12
|
-
"@qiwi/semantic-release-gh-pages-plugin": "^5.0
|
|
13
|
-
"@semantic-release/changelog": "^
|
|
14
|
-
"@semantic-release/exec": "^
|
|
15
|
-
"@semantic-release/git": "^
|
|
16
|
-
"@types/
|
|
17
|
-
"@types/
|
|
18
|
-
"@types/
|
|
19
|
-
"@
|
|
20
|
-
"@typescript-eslint/
|
|
21
|
-
"
|
|
22
|
-
"eslint": "^
|
|
23
|
-
"eslint-plugin-jsonc": "^1.3.1",
|
|
11
|
+
"@amanda-mitchell/semantic-release-npm-multiple": "^2.15.0",
|
|
12
|
+
"@qiwi/semantic-release-gh-pages-plugin": "^5.2.0",
|
|
13
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
14
|
+
"@semantic-release/exec": "^6.0.2",
|
|
15
|
+
"@semantic-release/git": "^10.0.1",
|
|
16
|
+
"@types/mocha": "^9.0.0",
|
|
17
|
+
"@types/node": "^16.11.10",
|
|
18
|
+
"@types/semantic-release": "^17.2.3",
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
20
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
21
|
+
"eslint": "^8.3.0",
|
|
22
|
+
"eslint-plugin-jsonc": "^2.0.0",
|
|
24
23
|
"license-checker": "^25.0.1",
|
|
25
|
-
"mocha": "^9.
|
|
26
|
-
"mochawesome": "^
|
|
24
|
+
"mocha": "^9.1.3",
|
|
25
|
+
"mochawesome": "^7.0.1",
|
|
27
26
|
"nyc": "^15.1.0",
|
|
28
27
|
"semantic-release-license": "^1.0.3",
|
|
29
|
-
"ts-node": "^10.
|
|
30
|
-
"typedoc": "^0.
|
|
31
|
-
"typescript": "^4.
|
|
28
|
+
"ts-node": "^10.4.0",
|
|
29
|
+
"typedoc": "^0.22.10",
|
|
30
|
+
"typescript": "^4.5.2"
|
|
32
31
|
},
|
|
33
32
|
"engines": {
|
|
34
33
|
"node": ">=12.0.0"
|
|
@@ -52,5 +51,5 @@
|
|
|
52
51
|
"lint": "eslint . --ext .ts,.json",
|
|
53
52
|
"test": "mocha"
|
|
54
53
|
},
|
|
55
|
-
"version": "1.0.
|
|
54
|
+
"version": "1.0.1-develop.2"
|
|
56
55
|
}
|