@sebbo2002/semantic-release-docker 1.0.1-develop.1 → 1.1.0
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 +1 -0
- package/dist/index.js +28 -10
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +20 -21
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2022 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
|
@@ -6,6 +6,7 @@ export declare function getBaseImage(input: string): string;
|
|
|
6
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
|
+
export declare function getUrlFromImage(image: string): string | undefined;
|
|
9
10
|
export declare function docker(command: string[]): Promise<void>;
|
|
10
11
|
export declare function tagImage(input: string, output: string): Promise<void>;
|
|
11
12
|
export declare function pushImage(image: string): Promise<void>;
|
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.isPreRelease = exports.getBaseImage = exports.parseConfig = void 0;
|
|
15
|
+
exports.publish = exports.pushImage = exports.tagImage = exports.docker = exports.getUrlFromImage = 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 = {
|
|
@@ -114,9 +114,6 @@ function getTagTasks(config, context) {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
// channel
|
|
117
|
-
// Sadly, channel is not defined in the types…
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
119
|
-
// @ts-ignore
|
|
120
117
|
const channel = (_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.channel;
|
|
121
118
|
if (config.tag.channel && channel) {
|
|
122
119
|
result.push({
|
|
@@ -128,13 +125,37 @@ function getTagTasks(config, context) {
|
|
|
128
125
|
return result;
|
|
129
126
|
}
|
|
130
127
|
exports.getTagTasks = getTagTasks;
|
|
128
|
+
function getUrlFromImage(image) {
|
|
129
|
+
const parts = getBaseImage(image).split('/');
|
|
130
|
+
if (parts[0] === 'ghcr.io' && parts.length === 3) {
|
|
131
|
+
return `https://github.com/${parts[1]}/${parts[2]}/pkgs/container/${parts[2]}`;
|
|
132
|
+
}
|
|
133
|
+
if (parts[0] === 'registry.gitlab.com' && parts.length >= 3) {
|
|
134
|
+
return `https://gitlab.com/${parts[1]}/${parts[2]}/container_registry`;
|
|
135
|
+
}
|
|
136
|
+
const couldBeAHostname = parts[0].includes('.');
|
|
137
|
+
if (!couldBeAHostname && parts.length === 2) {
|
|
138
|
+
return `https://hub.docker.com/r/${parts[0]}/${parts[1]}/tags`;
|
|
139
|
+
}
|
|
140
|
+
if (!couldBeAHostname && parts.length === 1) {
|
|
141
|
+
return `https://hub.docker.com/_/${parts[0]}/tags`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.getUrlFromImage = getUrlFromImage;
|
|
131
145
|
function docker(command) {
|
|
132
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
147
|
try {
|
|
134
|
-
yield execa_1.default('docker', command);
|
|
148
|
+
yield (0, execa_1.default)('docker', command);
|
|
135
149
|
}
|
|
136
150
|
catch (error) {
|
|
137
|
-
|
|
151
|
+
if (typeof error === 'object' && error !== null && 'command' in error && 'message' in error) {
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
throw new Error(`Unable to run "${error.command}": ${error.message}`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
throw new Error(`Unable to run "${command.join(' ')}": ${error}`);
|
|
158
|
+
}
|
|
138
159
|
}
|
|
139
160
|
});
|
|
140
161
|
}
|
|
@@ -169,14 +190,11 @@ function publish(pluginConfig, context) {
|
|
|
169
190
|
context.logger.log(`Push ${task.output}`);
|
|
170
191
|
yield pushImage(task.output);
|
|
171
192
|
}
|
|
172
|
-
// Sadly, channel is not defined in the types…
|
|
173
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
174
|
-
// @ts-ignore
|
|
175
193
|
const channel = (_a = context.nextRelease) === null || _a === void 0 ? void 0 : _a.channel;
|
|
176
194
|
const firstTask = tasks[0];
|
|
177
195
|
return {
|
|
178
196
|
name: `Docker container (${firstTask.output})`,
|
|
179
|
-
url: firstTask.output,
|
|
197
|
+
url: getUrlFromImage(firstTask.output),
|
|
180
198
|
channel
|
|
181
199
|
};
|
|
182
200
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,kDAA0B;AAY1B,SAAgB,WAAW,CAAE,MAAoB;IAC7C,MAAM,MAAM,GAA2B;QACnC,MAAM,EAAE,EAAE;QACV,GAAG,EAAE;YACD,MAAM,EAAE,IAAI;YAC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CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO;YACH,IAAI,EAAE,qBAAqB,SAAS,CAAC,MAAM,GAAG;YAC9C,GAAG,EAAE,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC;YACtC,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"
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"coverage": "nyc mocha",
|
|
51
50
|
"license-check": "license-checker --production --summary",
|
|
52
51
|
"lint": "eslint . --ext .ts,.json",
|
|
53
|
-
"test": "mocha"
|
|
52
|
+
"test": "docker pull alpine:latest && mocha"
|
|
54
53
|
},
|
|
55
|
-
"version": "1.
|
|
54
|
+
"version": "1.1.0"
|
|
56
55
|
}
|