@sebbo2002/semantic-release-docker 2.1.1-develop.1 → 3.0.0-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/LICENSE +1 -1
- package/dist/index.d.ts +51 -15
- package/dist/index.js +1 -240
- package/dist/index.js.map +1 -1
- package/package.json +22 -18
- package/dist/types.d.ts +0 -35
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2023 Sebastian Pekarek
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
6
6
|
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,55 @@
|
|
|
1
1
|
import { Context } from 'semantic-release';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
|
|
3
|
+
interface PluginConfig {
|
|
4
|
+
images: string | string[];
|
|
5
|
+
tag?: {
|
|
6
|
+
latest?: boolean;
|
|
7
|
+
major?: boolean;
|
|
8
|
+
minor?: boolean;
|
|
9
|
+
version?: boolean;
|
|
10
|
+
channel?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface NormalizedPluginConfigTags {
|
|
14
|
+
latest: boolean;
|
|
15
|
+
major: boolean;
|
|
16
|
+
minor: boolean;
|
|
17
|
+
version: boolean;
|
|
18
|
+
channel: boolean;
|
|
19
|
+
}
|
|
20
|
+
type PluginConfigTagKeys = keyof NormalizedPluginConfigTags;
|
|
21
|
+
interface NormalizedPluginConfig {
|
|
22
|
+
images: string[];
|
|
23
|
+
tag: NormalizedPluginConfigTags;
|
|
24
|
+
}
|
|
25
|
+
interface MajorAndMinorPart {
|
|
26
|
+
major: string | null;
|
|
27
|
+
minor: string | null;
|
|
28
|
+
}
|
|
29
|
+
interface TagTask {
|
|
30
|
+
input: string;
|
|
31
|
+
output: string;
|
|
32
|
+
}
|
|
33
|
+
interface PublishResponse {
|
|
34
|
+
name: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
channel?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare function parseConfig(config: PluginConfig): NormalizedPluginConfig;
|
|
40
|
+
declare function getBaseImage(input: string): string;
|
|
41
|
+
declare function isPreRelease(context: Context): boolean;
|
|
42
|
+
declare function getMajorAndMinorPart(version: string | undefined): MajorAndMinorPart;
|
|
43
|
+
declare function getTagTasks(config: NormalizedPluginConfig, context: Context): TagTask[];
|
|
44
|
+
declare function getUrlFromImage(image: string): string | undefined;
|
|
45
|
+
declare function exec(file: string, args: string[]): Promise<void>;
|
|
46
|
+
declare function isRegCtlAvailable(): Promise<boolean>;
|
|
47
|
+
declare function tagImage(input: string, output: string): Promise<void>;
|
|
48
|
+
declare function pushImage(image: string): Promise<void>;
|
|
49
|
+
declare function copyImage(input: string, output: string): Promise<void>;
|
|
50
|
+
declare function publish(pluginConfig: PluginConfig, context: Context): Promise<boolean | PublishResponse>;
|
|
16
51
|
declare const _default: {
|
|
17
52
|
publish: typeof publish;
|
|
18
53
|
};
|
|
19
|
-
|
|
54
|
+
|
|
55
|
+
export { MajorAndMinorPart, NormalizedPluginConfig, NormalizedPluginConfigTags, PluginConfig, PluginConfigTagKeys, TagTask, copyImage, _default as default, exec, getBaseImage, getMajorAndMinorPart, getTagTasks, getUrlFromImage, isPreRelease, isRegCtlAvailable, parseConfig, publish, pushImage, tagImage };
|
package/dist/index.js
CHANGED
|
@@ -1,241 +1,2 @@
|
|
|
1
|
-
"
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.publish = exports.copyImage = exports.pushImage = exports.tagImage = exports.isRegCtlAvailable = exports.exec = exports.getUrlFromImage = exports.getTagTasks = exports.getMajorAndMinorPart = exports.isPreRelease = exports.getBaseImage = exports.parseConfig = void 0;
|
|
16
|
-
const execa_1 = __importDefault(require("execa"));
|
|
17
|
-
let IS_REGCTL_AVAILABLE = undefined;
|
|
18
|
-
function parseConfig(config) {
|
|
19
|
-
const result = {
|
|
20
|
-
images: [],
|
|
21
|
-
tag: {
|
|
22
|
-
latest: true,
|
|
23
|
-
major: true,
|
|
24
|
-
minor: true,
|
|
25
|
-
version: true,
|
|
26
|
-
channel: true
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
if (typeof config.images === 'string') {
|
|
30
|
-
result.images.push(config.images);
|
|
31
|
-
}
|
|
32
|
-
else if (Array.isArray(config.images)) {
|
|
33
|
-
config.images
|
|
34
|
-
.filter(image => typeof image === 'string')
|
|
35
|
-
.forEach(image => result.images.push(image));
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
throw new Error('Configuration invalid: No image defined!');
|
|
39
|
-
}
|
|
40
|
-
const tagNames = Object.keys(result.tag);
|
|
41
|
-
tagNames.forEach(name => {
|
|
42
|
-
const value = config.tag ? config.tag[name] : undefined;
|
|
43
|
-
if (value === true || value === false) {
|
|
44
|
-
result.tag[name] = value;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
exports.parseConfig = parseConfig;
|
|
50
|
-
function getBaseImage(input) {
|
|
51
|
-
let p = input.split('@')[0].split(':');
|
|
52
|
-
// it's a ":port"
|
|
53
|
-
if (p[1] && p[1].includes('/')) {
|
|
54
|
-
p = [p[0] + ':' + p[1], p[2]];
|
|
55
|
-
}
|
|
56
|
-
return p[0];
|
|
57
|
-
}
|
|
58
|
-
exports.getBaseImage = getBaseImage;
|
|
59
|
-
function isPreRelease(context) {
|
|
60
|
-
return Boolean(context.nextRelease && context.nextRelease.version.includes('-'));
|
|
61
|
-
}
|
|
62
|
-
exports.isPreRelease = isPreRelease;
|
|
63
|
-
function getMajorAndMinorPart(version) {
|
|
64
|
-
if (!version) {
|
|
65
|
-
return {
|
|
66
|
-
major: null,
|
|
67
|
-
minor: null
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const parts = version.split('.', 2);
|
|
71
|
-
return {
|
|
72
|
-
major: parts[0],
|
|
73
|
-
minor: parts[1]
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
exports.getMajorAndMinorPart = getMajorAndMinorPart;
|
|
77
|
-
function getTagTasks(config, context) {
|
|
78
|
-
const result = [];
|
|
79
|
-
if (!context.nextRelease) {
|
|
80
|
-
return [];
|
|
81
|
-
}
|
|
82
|
-
const version = context.nextRelease.version;
|
|
83
|
-
config.images.forEach(input => {
|
|
84
|
-
var _a;
|
|
85
|
-
const outputBase = getBaseImage(input);
|
|
86
|
-
// version
|
|
87
|
-
if (config.tag.version && version) {
|
|
88
|
-
result.push({
|
|
89
|
-
input,
|
|
90
|
-
output: `${outputBase}:${version}`
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
if (!isPreRelease(context)) {
|
|
94
|
-
const { major, minor } = getMajorAndMinorPart(version);
|
|
95
|
-
// latest
|
|
96
|
-
if (config.tag.latest) {
|
|
97
|
-
result.push({
|
|
98
|
-
input,
|
|
99
|
-
output: `${outputBase}:latest`
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
// major
|
|
103
|
-
if (config.tag.major && major) {
|
|
104
|
-
result.push({
|
|
105
|
-
input,
|
|
106
|
-
output: `${outputBase}:${major}`
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
// minor
|
|
110
|
-
if (config.tag.minor && major && minor) {
|
|
111
|
-
result.push({
|
|
112
|
-
input,
|
|
113
|
-
output: `${outputBase}:${major}.${minor}`
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// channel
|
|
118
|
-
const channel = (_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.channel;
|
|
119
|
-
if (config.tag.channel && channel) {
|
|
120
|
-
result.push({
|
|
121
|
-
input,
|
|
122
|
-
output: `${outputBase}:${channel}`
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
exports.getTagTasks = getTagTasks;
|
|
129
|
-
function getUrlFromImage(image) {
|
|
130
|
-
const parts = getBaseImage(image).split('/');
|
|
131
|
-
if (parts[0] === 'ghcr.io' && parts.length === 3) {
|
|
132
|
-
return `https://github.com/${parts[1]}/${parts[2]}/pkgs/container/${parts[2]}`;
|
|
133
|
-
}
|
|
134
|
-
if (parts[0] === 'registry.gitlab.com' && parts.length >= 3) {
|
|
135
|
-
return `https://gitlab.com/${parts[1]}/${parts[2]}/container_registry`;
|
|
136
|
-
}
|
|
137
|
-
const couldBeAHostname = parts[0].includes('.');
|
|
138
|
-
if (!couldBeAHostname && parts.length === 2) {
|
|
139
|
-
return `https://hub.docker.com/r/${parts[0]}/${parts[1]}/tags`;
|
|
140
|
-
}
|
|
141
|
-
if (!couldBeAHostname && parts.length === 1) {
|
|
142
|
-
return `https://hub.docker.com/_/${parts[0]}/tags`;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
exports.getUrlFromImage = getUrlFromImage;
|
|
146
|
-
function exec(file, args) {
|
|
147
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
try {
|
|
149
|
-
yield (0, execa_1.default)(file, args);
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
if (typeof error === 'object' && error !== null && 'command' in error && 'message' in error) {
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
throw new Error(`Unable to run "${error.command}": ${error.message}`);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
throw new Error(`Unable to run "${args.join(' ')}": ${error}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
exports.exec = exec;
|
|
164
|
-
function isRegCtlAvailable() {
|
|
165
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
if (IS_REGCTL_AVAILABLE !== undefined) {
|
|
167
|
-
return IS_REGCTL_AVAILABLE;
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
yield (0, execa_1.default)('which', ['regctl']);
|
|
171
|
-
IS_REGCTL_AVAILABLE = true;
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
IS_REGCTL_AVAILABLE = false;
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
exports.isRegCtlAvailable = isRegCtlAvailable;
|
|
181
|
-
function tagImage(input, output) {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
yield exec('docker', ['tag', input, output]);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
exports.tagImage = tagImage;
|
|
187
|
-
function pushImage(image) {
|
|
188
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
-
yield exec('docker', ['push', image]);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
exports.pushImage = pushImage;
|
|
193
|
-
function copyImage(input, output) {
|
|
194
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
yield exec('regctl', ['image', 'copy', input, output]);
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
exports.copyImage = copyImage;
|
|
199
|
-
function publish(pluginConfig, context) {
|
|
200
|
-
var _a;
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
if (!context.nextRelease) {
|
|
203
|
-
context.logger.log('No release schedules, so no images to tag.');
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
const config = parseConfig(pluginConfig);
|
|
207
|
-
const tasks = getTagTasks(config, context);
|
|
208
|
-
if (!tasks.length) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
for (const task of tasks) {
|
|
212
|
-
if (yield isRegCtlAvailable()) {
|
|
213
|
-
context.logger.log(`Copy with regctl ${task.input} → ${task.output}`);
|
|
214
|
-
try {
|
|
215
|
-
yield copyImage(task.input, task.output);
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
context.logger.error(error);
|
|
220
|
-
context.logger.log('Retry without regctl…');
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
context.logger.log(`Tag ${task.input} → ${task.output}`);
|
|
224
|
-
yield tagImage(task.input, task.output);
|
|
225
|
-
context.logger.log(`Push ${task.output}`);
|
|
226
|
-
yield pushImage(task.output);
|
|
227
|
-
}
|
|
228
|
-
const channel = (_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.channel;
|
|
229
|
-
const firstTask = tasks[0];
|
|
230
|
-
return {
|
|
231
|
-
name: `Docker container (${firstTask.output})`,
|
|
232
|
-
url: getUrlFromImage(firstTask.output),
|
|
233
|
-
channel
|
|
234
|
-
};
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
exports.publish = publish;
|
|
238
|
-
exports.default = {
|
|
239
|
-
publish
|
|
240
|
-
};
|
|
1
|
+
var g=(t,e,r)=>new Promise((o,i)=>{var s=a=>{try{n(r.next(a))}catch(l){i(l)}},u=a=>{try{n(r.throw(a))}catch(l){i(l)}},n=a=>a.done?o(a.value):Promise.resolve(a.value).then(s,u);n((r=r.apply(t,e)).next())});import{execa as p}from"execa";var f;function h(t){let e={images:[],tag:{latest:!0,major:!0,minor:!0,version:!0,channel:!0}};if(typeof t.images=="string")e.images.push(t.images);else if(Array.isArray(t.images))t.images.filter(o=>typeof o=="string").forEach(o=>e.images.push(o));else throw new Error("Configuration invalid: No image defined!");return Object.keys(e.tag).forEach(o=>{let i=t.tag?t.tag[o]:void 0;(i===!0||i===!1)&&(e.tag[o]=i)}),e}function m(t){let e=t.split("@")[0].split(":");return e[1]&&e[1].includes("/")&&(e=[e[0]+":"+e[1],e[2]]),e[0]}function d(t){return!!(t.nextRelease&&t.nextRelease.version.includes("-"))}function $(t){if(!t)return{major:null,minor:null};let e=t.split(".",2);return{major:e[0],minor:e[1]}}function y(t,e){let r=[];if(!e.nextRelease)return[];let o=e.nextRelease.version;return t.images.forEach(i=>{var n;let s=m(i);if(t.tag.version&&o&&r.push({input:i,output:`${s}:${o}`}),!d(e)){let{major:a,minor:l}=$(o);t.tag.latest&&r.push({input:i,output:`${s}:latest`}),t.tag.major&&a&&r.push({input:i,output:`${s}:${a}`}),t.tag.minor&&a&&l&&r.push({input:i,output:`${s}:${a}.${l}`})}let u=(n=e.nextRelease)==null?void 0:n.channel;t.tag.channel&&u&&r.push({input:i,output:`${s}:${u}`})}),r}function P(t){let e=m(t).split("/");if(e[0]==="ghcr.io"&&e.length===3)return`https://github.com/${e[1]}/${e[2]}/pkgs/container/${e[2]}`;if(e[0]==="registry.gitlab.com"&&e.length>=3)return`https://gitlab.com/${e[1]}/${e[2]}/container_registry`;let r=e[0].includes(".");if(!r&&e.length===2)return`https://hub.docker.com/r/${e[0]}/${e[1]}/tags`;if(!r&&e.length===1)return`https://hub.docker.com/_/${e[0]}/tags`}function c(t,e){return g(this,null,function*(){try{yield p(t,e)}catch(r){throw typeof r=="object"&&r!==null&&"command"in r&&"message"in r?new Error(`Unable to run "${r.command}": ${r.message}`):new Error(`Unable to run "${e.join(" ")}": ${r}`)}})}function C(){return g(this,null,function*(){if(f!==void 0)return f;try{return yield p("which",["regctl"]),f=!0,!0}catch(t){return f=!1,!1}})}function w(t,e){return g(this,null,function*(){yield c("docker",["tag",t,e])})}function b(t){return g(this,null,function*(){yield c("docker",["push",t])})}function x(t,e){return g(this,null,function*(){yield c("regctl",["image","copy",t,e])})}function k(t,e){return g(this,null,function*(){var u;if(!e.nextRelease)return e.logger.log("No release schedules, so no images to tag."),!1;let r=h(t),o=y(r,e);if(!o.length)return!1;for(let n of o){if(yield C()){e.logger.log(`Copy with regctl ${n.input} \u2192 ${n.output}`);try{yield x(n.input,n.output);continue}catch(a){e.logger.error(a),e.logger.log("Retry without regctl\u2026")}}e.logger.log(`Tag ${n.input} \u2192 ${n.output}`),yield w(n.input,n.output),e.logger.log(`Push ${n.output}`),yield b(n.output)}let i=(u=e.nextRelease)==null?void 0:u.channel,s=o[0];return{name:`Docker container (${s.output})`,url:P(s.output),channel:i}})}var j={publish:k};export{x as copyImage,j as default,c as exec,m as getBaseImage,$ as getMajorAndMinorPart,y as getTagTasks,P as getUrlFromImage,d as isPreRelease,C as isRegCtlAvailable,h as parseConfig,k as publish,b as pushImage,w as tagImage};
|
|
241
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,kDAA0B;AAW1B,IAAI,mBAAmB,GAAuB,SAAS,CAAC;AAExD,SAAgB,WAAW,CAAE,MAA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CAAC;YACtC,OAAO;SACV,CAAC;;CACL;AAxCD,0BAwCC;AAED,kBAAe;IACX,OAAO;CACV,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/lib/index.ts"],"sourcesContent":["import { Context } from 'semantic-release';\nimport {\n MajorAndMinorPart,\n NormalizedPluginConfigTags,\n NormalizedPluginConfig,\n PluginConfig,\n PluginConfigTagKeys,\n TagTask,\n PublishResponse\n} from './types.js';\nimport { execa } from 'execa';\n\nexport {\n PluginConfig,\n NormalizedPluginConfigTags,\n NormalizedPluginConfig,\n PluginConfigTagKeys,\n MajorAndMinorPart,\n TagTask\n};\n\nlet IS_REGCTL_AVAILABLE: boolean | undefined= undefined;\n\nexport function parseConfig (config: PluginConfig): NormalizedPluginConfig {\n const result: NormalizedPluginConfig = {\n images: [],\n tag: {\n latest: true,\n major: true,\n minor: true,\n version: true,\n channel: true\n }\n };\n\n if (typeof config.images === 'string') {\n result.images.push(config.images);\n } else if (Array.isArray(config.images)) {\n config.images\n .filter(image => typeof image === 'string')\n .forEach(image => result.images.push(image));\n } else {\n throw new Error('Configuration invalid: No image defined!');\n }\n\n const tagNames = Object.keys(result.tag) as PluginConfigTagKeys[];\n tagNames.forEach(name => {\n const value = config.tag ? config.tag[name] : undefined;\n if (value === true || value === false) {\n result.tag[name] = value;\n }\n });\n\n return result;\n}\n\nexport function getBaseImage (input: string): string {\n let p = input.split('@')[0].split(':');\n\n // it's a \":port\"\n if (p[1] && p[1].includes('/')) {\n p = [p[0] + ':' + p[1], p[2]];\n }\n\n return p[0];\n}\n\nexport function isPreRelease (context: Context): boolean {\n return Boolean(context.nextRelease && context.nextRelease.version.includes('-'));\n}\n\nexport function getMajorAndMinorPart (version: string | undefined): MajorAndMinorPart {\n if (!version) {\n return {\n major: null,\n minor: null\n };\n }\n\n const parts = version.split('.', 2);\n return {\n major: parts[0],\n minor: parts[1]\n };\n}\n\nexport function getTagTasks (config: NormalizedPluginConfig, context: Context): TagTask[] {\n const result: TagTask[] = [];\n\n if (!context.nextRelease) {\n return [];\n }\n\n const version = context.nextRelease.version;\n config.images.forEach(input => {\n const outputBase = getBaseImage(input);\n\n // version\n if (config.tag.version && version) {\n result.push({\n input,\n output: `${outputBase}:${version}`\n });\n }\n\n if (!isPreRelease(context)) {\n const { major, minor } = getMajorAndMinorPart(version);\n\n // latest\n if (config.tag.latest) {\n result.push({\n input,\n output: `${outputBase}:latest`\n });\n }\n\n // major\n if (config.tag.major && major) {\n result.push({\n input,\n output: `${outputBase}:${major}`\n });\n }\n\n // minor\n if (config.tag.minor && major && minor) {\n result.push({\n input,\n output: `${outputBase}:${major}.${minor}`\n });\n }\n }\n\n // channel\n const channel = context.nextRelease?.channel;\n if (config.tag.channel && channel) {\n result.push({\n input,\n output: `${outputBase}:${channel}`\n });\n }\n });\n\n return result;\n}\n\nexport function getUrlFromImage (image: string): string | undefined {\n const parts = getBaseImage(image).split('/');\n if (parts[0] === 'ghcr.io' && parts.length === 3) {\n return `https://github.com/${parts[1]}/${parts[2]}/pkgs/container/${parts[2]}`;\n }\n if (parts[0] === 'registry.gitlab.com' && parts.length >= 3) {\n return `https://gitlab.com/${parts[1]}/${parts[2]}/container_registry`;\n }\n\n const couldBeAHostname = parts[0].includes('.');\n if (!couldBeAHostname && parts.length === 2) {\n return `https://hub.docker.com/r/${parts[0]}/${parts[1]}/tags`;\n }\n if (!couldBeAHostname && parts.length === 1) {\n return `https://hub.docker.com/_/${parts[0]}/tags`;\n }\n}\n\nexport async function exec (file: string, args: string[]): Promise<void> {\n try {\n await execa(file, args);\n } catch (error) {\n if (typeof error === 'object' && error !== null && 'command' in error && 'message' in error) {\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n throw new Error(`Unable to run \"${error.command}\": ${error.message}`);\n } else {\n throw new Error(`Unable to run \"${args.join(' ')}\": ${error}`);\n }\n }\n}\n\nexport async function isRegCtlAvailable (): Promise<boolean> {\n if(IS_REGCTL_AVAILABLE !== undefined) {\n return IS_REGCTL_AVAILABLE;\n }\n\n try {\n await execa('which', ['regctl']);\n IS_REGCTL_AVAILABLE = true;\n return true;\n }\n catch(error) {\n IS_REGCTL_AVAILABLE = false;\n return false;\n }\n}\n\nexport async function tagImage (input: string, output: string): Promise<void> {\n await exec('docker', ['tag', input, output]);\n}\n\nexport async function pushImage (image: string): Promise<void> {\n await exec('docker', ['push', image]);\n}\n\nexport async function copyImage (input: string, output: string): Promise<void> {\n await exec('regctl', ['image', 'copy', input, output]);\n}\n\nexport async function publish (pluginConfig: PluginConfig, context: Context): Promise<boolean | PublishResponse> {\n if (!context.nextRelease) {\n context.logger.log('No release schedules, so no images to tag.');\n return false;\n }\n\n const config = parseConfig(pluginConfig);\n const tasks = getTagTasks(config, context);\n if (!tasks.length) {\n return false;\n }\n\n for (const task of tasks) {\n if(await isRegCtlAvailable()) {\n context.logger.log(`Copy with regctl ${task.input} → ${task.output}`);\n\n try {\n await copyImage(task.input, task.output);\n continue;\n }\n catch(error) {\n context.logger.error(error);\n context.logger.log('Retry without regctl…');\n }\n }\n\n context.logger.log(`Tag ${task.input} → ${task.output}`);\n await tagImage(task.input, task.output);\n\n context.logger.log(`Push ${task.output}`);\n await pushImage(task.output);\n }\n\n const channel = context.nextRelease?.channel;\n const firstTask = tasks[0];\n return {\n name: `Docker container (${firstTask.output})`,\n url: getUrlFromImage(firstTask.output),\n channel\n };\n}\n\nexport default {\n publish\n};\n"],"mappings":"6MAUA,OAAS,SAAAA,MAAa,QAWtB,IAAIC,EAEG,SAASC,EAAaC,EAA8C,CACvE,IAAMC,EAAiC,CACnC,OAAQ,CAAC,EACT,IAAK,CACD,OAAQ,GACR,MAAO,GACP,MAAO,GACP,QAAS,GACT,QAAS,EACb,CACJ,EAEA,GAAI,OAAOD,EAAO,QAAW,SACzBC,EAAO,OAAO,KAAKD,EAAO,MAAM,UACzB,MAAM,QAAQA,EAAO,MAAM,EAClCA,EAAO,OACF,OAAOE,GAAS,OAAOA,GAAU,QAAQ,EACzC,QAAQA,GA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AAQ,OAAO,IAAI,OAAO0B,EAAK,gBAAWA,EAAK,QAAQ,EACvD,MAAMP,EAASO,EAAK,MAAOA,EAAK,MAAM,EAEtC1B,EAAQ,OAAO,IAAI,QAAQ0B,EAAK,QAAQ,EACxC,MAAML,EAAUK,EAAK,MAAM,EAG/B,IAAMjB,GAAUJ,EAAAL,EAAQ,cAAR,YAAAK,EAAqB,QAC/BsB,EAAYF,EAAM,CAAC,EACzB,MAAO,CACH,KAAM,qBAAqBE,EAAU,UACrC,IAAKjB,EAAgBiB,EAAU,MAAM,EACrC,QAAAlB,CACJ,CACJ,GAEA,IAAOmB,EAAQ,CACX,QAAAL,CACJ","names":["execa","IS_REGCTL_AVAILABLE","parseConfig","config","result","image","name","value","getBaseImage","input","p","isPreRelease","context","getMajorAndMinorPart","version","parts","getTagTasks","_a","outputBase","major","minor","channel","getUrlFromImage","couldBeAHostname","exec","file","args","__async","execa","error","isRegCtlAvailable","tagImage","output","pushImage","copyImage","publish","pluginConfig","tasks","task","firstTask","lib_default"]}
|
package/package.json
CHANGED
|
@@ -4,53 +4,57 @@
|
|
|
4
4
|
"url": "https://github.com/sebbo2002/semantic-release-docker/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"execa": "^
|
|
7
|
+
"execa": "^7.1.1"
|
|
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
|
-
"@
|
|
12
|
-
"@
|
|
13
|
-
"@semantic-release/changelog": "^6.0.1",
|
|
11
|
+
"@qiwi/semantic-release-gh-pages-plugin": "^5.2.5",
|
|
12
|
+
"@semantic-release/changelog": "^6.0.2",
|
|
14
13
|
"@semantic-release/exec": "^6.0.3",
|
|
15
14
|
"@semantic-release/git": "^10.0.1",
|
|
15
|
+
"@semantic-release/npm": "^9.0.2",
|
|
16
16
|
"@types/mocha": "^10.0.0",
|
|
17
|
-
"@types/node": "^18.
|
|
18
|
-
"@types/semantic-release": "^
|
|
19
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
20
|
-
"@typescript-eslint/parser": "^5.
|
|
21
|
-
"c8": "^7.
|
|
22
|
-
"eslint": "^8.
|
|
23
|
-
"eslint-plugin-jsonc": "^2.
|
|
17
|
+
"@types/node": "^18.15.3",
|
|
18
|
+
"@types/semantic-release": "^20.0.1",
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
20
|
+
"@typescript-eslint/parser": "^5.54.1",
|
|
21
|
+
"c8": "^7.13.0",
|
|
22
|
+
"eslint": "^8.36.0",
|
|
23
|
+
"eslint-plugin-jsonc": "^2.7.0",
|
|
24
24
|
"license-checker": "^25.0.1",
|
|
25
|
-
"mocha": "^10.
|
|
25
|
+
"mocha": "^10.2.0",
|
|
26
26
|
"mochawesome": "^7.1.3",
|
|
27
27
|
"semantic-release-license": "^1.0.3",
|
|
28
28
|
"source-map-support": "^0.5.21",
|
|
29
29
|
"ts-node": "^10.8.2",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"tsup": "^6.7.0",
|
|
31
|
+
"typedoc": "^0.23.28",
|
|
32
|
+
"typescript": "^5.0.2"
|
|
32
33
|
},
|
|
33
34
|
"engines": {
|
|
34
|
-
"node": "^
|
|
35
|
+
"node": "^14.8.0 || >=16.0.0"
|
|
35
36
|
},
|
|
37
|
+
"exports": "./dist/index.js",
|
|
36
38
|
"files": [
|
|
37
39
|
"/dist"
|
|
38
40
|
],
|
|
39
41
|
"homepage": "https://github.com/sebbo2002/semantic-release-docker#readme",
|
|
40
42
|
"license": "MIT",
|
|
41
|
-
"main": "dist/index.js",
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"module": "./dist/index.js",
|
|
42
45
|
"name": "@sebbo2002/semantic-release-docker",
|
|
43
46
|
"repository": {
|
|
44
47
|
"type": "git",
|
|
45
48
|
"url": "git+https://github.com/sebbo2002/semantic-release-docker.git"
|
|
46
49
|
},
|
|
47
50
|
"scripts": {
|
|
48
|
-
"build": "
|
|
51
|
+
"build": "tsup",
|
|
49
52
|
"build-all": "./.github/workflows/build.sh",
|
|
50
53
|
"coverage": "c8 mocha",
|
|
51
54
|
"license-check": "license-checker --production --summary",
|
|
52
55
|
"lint": "eslint . --ext .ts,.json",
|
|
53
56
|
"test": "docker pull alpine:latest && mocha"
|
|
54
57
|
},
|
|
55
|
-
"
|
|
58
|
+
"type": "module",
|
|
59
|
+
"version": "3.0.0-develop.2"
|
|
56
60
|
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface PluginConfig {
|
|
2
|
-
images: string | string[];
|
|
3
|
-
tag?: {
|
|
4
|
-
latest?: boolean;
|
|
5
|
-
major?: boolean;
|
|
6
|
-
minor?: boolean;
|
|
7
|
-
version?: boolean;
|
|
8
|
-
channel?: boolean;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export interface NormalizedPluginConfigTags {
|
|
12
|
-
latest: boolean;
|
|
13
|
-
major: boolean;
|
|
14
|
-
minor: boolean;
|
|
15
|
-
version: boolean;
|
|
16
|
-
channel: boolean;
|
|
17
|
-
}
|
|
18
|
-
export type PluginConfigTagKeys = keyof NormalizedPluginConfigTags;
|
|
19
|
-
export interface NormalizedPluginConfig {
|
|
20
|
-
images: string[];
|
|
21
|
-
tag: NormalizedPluginConfigTags;
|
|
22
|
-
}
|
|
23
|
-
export interface MajorAndMinorPart {
|
|
24
|
-
major: string | null;
|
|
25
|
-
minor: string | null;
|
|
26
|
-
}
|
|
27
|
-
export interface TagTask {
|
|
28
|
-
input: string;
|
|
29
|
-
output: string;
|
|
30
|
-
}
|
|
31
|
-
export interface PublishResponse {
|
|
32
|
-
name: string;
|
|
33
|
-
url?: string;
|
|
34
|
-
channel?: string;
|
|
35
|
-
}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":""}
|