@wtf/semantic-release-oci 2.0.0 → 3.0.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/README.md +36 -15
- package/dist/index.d.ts +35 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +174 -66
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +5 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +10 -5
- package/dist/schema.js.map +1 -1
- package/package.json +8 -4
- package/schema.json +11 -0
package/README.md
CHANGED
|
@@ -33,17 +33,37 @@ export default {
|
|
|
33
33
|
- `verifyConditions` checks the options, that `ecosystems` lists `'@wtf/release-oci'` or
|
|
34
34
|
`'@wtf/semantic-release-oci/ecosystem'` (`EOCIECOSYSTEM`), and the train; reads the images git
|
|
35
35
|
tracks; picks the images of the train; and names the repository of each, of the option `image` or
|
|
36
|
-
`CI_REGISTRY_IMAGE` of the run (`EOCIIMAGE`).
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
`CI_REGISTRY_IMAGE` of the run (`EOCIIMAGE`). Then it asks GitLab once, with no effect, whether the
|
|
37
|
+
run's token may read the API of the container registry, which the links need (`EOCILINK`). A dry
|
|
38
|
+
run of no token, as of a merge request, only says so. It asks crane nothing.
|
|
39
|
+
- `verifyRelease` runs the step `verify` of the ecosystem of OCI images of `@wtf/release-oci`, by
|
|
40
|
+
`runStep` of `@wtf/release/driver`, once the version is known: it checks the version and its
|
|
41
|
+
tags, and the repository of each image of the train.
|
|
42
|
+
- `publish` runs the steps `publish` and `move` of the ecosystem, over the plan of the train: it
|
|
43
|
+
finds the tested image of each image,
|
|
44
|
+
`<sourceRepository>:<sourceTag>`, by its digest, of the platforms of `platforms` (`EOCISMOKE`);
|
|
45
|
+
copies it by crane to the tag of the version; and of a release, points its minor and its major,
|
|
46
|
+
which move, at the digest of the version. A version the registry has at the same digest is
|
|
47
|
+
skipped, so a release that stopped part way is finished by running it again; at another digest it
|
|
48
|
+
is refused, and nothing is copied (`EOCIRETAG`). It records each image for the links of the
|
|
42
49
|
GitLab release of the tag, which
|
|
43
50
|
`['@wtf/semantic-release-trains', { wrap: '@semantic-release/gitlab' }]` makes: its page in the
|
|
44
51
|
container registry of the project, which the Container Registry API names (`EOCILINK`).
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
The plugin names the tags that move of a version, as semantic-release's versions are: `1.4` and `1`
|
|
54
|
+
of `1.4.2`, `0.3` alone of `0.3.1`, as a minor of `0` breaks what the one before gave, and none of
|
|
55
|
+
a prerelease, as `8.0.0-next.1`, nor of the option `moving: false`.
|
|
56
|
+
|
|
57
|
+
A dry run runs `verifyConditions` and `verifyRelease` alone of these, so it copies nothing. What
|
|
58
|
+
the plugin says in the log of a step of the release, and each error of it, names the train, as
|
|
59
|
+
`[train base] …`.
|
|
60
|
+
|
|
61
|
+
The links need a token of GitLab's API, `GITLAB_TOKEN` or `GL_TOKEN` of the `read_api` or `api`
|
|
62
|
+
scope, protected and masked, as semantic-release takes it to push the release: the API of the
|
|
63
|
+
container registry refuses the job token, `CI_JOB_TOKEN`. A run of none fails in `verifyConditions`,
|
|
64
|
+
and in `publish` before anything is copied. `publish` then writes what it published to `oci.env`, for
|
|
65
|
+
a later job of the pipeline (`artifacts:reports:dotenv`): `oci_version`, `oci_images`, each
|
|
66
|
+
`<repository>@<digest>`, and `oci_tags`.
|
|
47
67
|
|
|
48
68
|
crane runs on the path of the run, logged in to the registry, as `crane auth login` writes its
|
|
49
69
|
config: of a pipeline of GitLab, `echo "$CI_REGISTRY_PASSWORD" | crane auth login --username
|
|
@@ -51,14 +71,15 @@ config: of a pipeline of GitLab, `echo "$CI_REGISTRY_PASSWORD" | crane auth logi
|
|
|
51
71
|
|
|
52
72
|
## Options
|
|
53
73
|
|
|
54
|
-
| Option | Default | What it is
|
|
55
|
-
| ------------------ | ------------------------------- |
|
|
56
|
-
| `image` | `CI_REGISTRY_IMAGE` of the run | The registry image of the project: the root's, and that and its folder of another
|
|
57
|
-
| `sourceRepository` | `{image}/snapshot` | The repository of the tested image, `{image}` the image's own
|
|
58
|
-
| `sourceTag` | `CI_COMMIT_REF_SLUG` of the run | The tag of the tested image: the snapshot of the pipeline of the tag
|
|
59
|
-
| `moving` | `true` | Whether a release moves its minor and its major
|
|
60
|
-
| `platforms` | any | The platforms each tested image must be of, as `linux/amd64`
|
|
61
|
-
| `crane` | `crane` | The command of crane
|
|
74
|
+
| Option | Default | What it is |
|
|
75
|
+
| ------------------ | ------------------------------- | ----------------------------------------------------------------------------------- |
|
|
76
|
+
| `image` | `CI_REGISTRY_IMAGE` of the run | The registry image of the project: the root's, and that and its folder of another |
|
|
77
|
+
| `sourceRepository` | `{image}/snapshot` | The repository of the tested image, `{image}` the image's own |
|
|
78
|
+
| `sourceTag` | `CI_COMMIT_REF_SLUG` of the run | The tag of the tested image: the snapshot of the pipeline of the tag |
|
|
79
|
+
| `moving` | `true` | Whether a release moves its minor and its major |
|
|
80
|
+
| `platforms` | any | The platforms each tested image must be of, as `linux/amd64` |
|
|
81
|
+
| `crane` | `crane` | The command of crane |
|
|
82
|
+
| `dotenv` | `oci.env` | The dotenv file of the images published, from the root of the repo; none of `false` |
|
|
62
83
|
|
|
63
84
|
`./schema` holds the validators of the options and of this package's part of a config;
|
|
64
85
|
`schema.json` is its JSON Schema. `./ecosystem` is the ecosystem of `@wtf/release-oci`, beside the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SystemInput } from '@wtf/release-system';
|
|
2
1
|
import type { Trains } from '@wtf/release-trains';
|
|
3
|
-
import type { PublishContext, VerifyConditionsContext } from 'semantic-release';
|
|
2
|
+
import type { PublishContext, VerifyConditionsContext, VerifyReleaseContext } from 'semantic-release';
|
|
4
3
|
/** The options of the plugin, in the config of semantic-release or at its root. */
|
|
5
4
|
export interface OciPluginOptions {
|
|
6
5
|
/** Every train of the repo: the images of each are those whose folder its paths hold. */
|
|
@@ -34,8 +33,13 @@ export interface OciPluginOptions {
|
|
|
34
33
|
readonly platforms?: readonly string[] | undefined;
|
|
35
34
|
/** The command of crane, by its name on the path or its path: `crane` by default. */
|
|
36
35
|
readonly crane?: string | undefined;
|
|
37
|
-
/**
|
|
38
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The dotenv file `publish` writes of the images it published, from the root of the repo, for a
|
|
38
|
+
* job of the pipeline to read (`artifacts:reports:dotenv`): `oci_version`, `oci_images`, each
|
|
39
|
+
* `<repository>@<digest>`, and `oci_tags`, each space-separated; `oci.env` by default, none of
|
|
40
|
+
* `false`.
|
|
41
|
+
*/
|
|
42
|
+
readonly dotenv?: string | false | undefined;
|
|
39
43
|
}
|
|
40
44
|
/** The release the plugin gives semantic-release of the images copied. */
|
|
41
45
|
export interface OciRelease {
|
|
@@ -53,19 +57,35 @@ type OfRun = {
|
|
|
53
57
|
* Checks the options of the plugin, by `ociSchema` of `./schema` (`EOPTIONS`), that `ecosystems`
|
|
54
58
|
* lists `@wtf/semantic-release-oci/ecosystem` or `@wtf/release-oci` (`EOCIECOSYSTEM`), and the train
|
|
55
59
|
* of the run (`ETRAINNOTSELECTED`, `ETRAINUNKNOWN`); that no image is of two trains
|
|
56
|
-
* (`ETRAINOVERLAP`); and that each image of the train has a repository (`EOCIIMAGE`).
|
|
57
|
-
* registry
|
|
60
|
+
* (`ETRAINOVERLAP`); and that each image of the train has a repository (`EOCIIMAGE`). Then that
|
|
61
|
+
* the run may read the API of the container registry, which the links of `publish` need, by one
|
|
62
|
+
* request of no effect (`EOCILINK`): of a token of `GL_TOKEN` or `GITLAB_TOKEN`, which a dry run of
|
|
63
|
+
* none, as of a merge request, only warns of. It asks crane nothing.
|
|
58
64
|
*
|
|
59
65
|
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
60
66
|
* @param context - The context of semantic-release's `verifyConditions` step: the folder, the
|
|
61
67
|
* environment and the logger of the run.
|
|
62
68
|
*/
|
|
63
|
-
export declare
|
|
69
|
+
export declare const verifyConditions: (pluginConfig: OciPluginOptions, context: VerifyConditionsContext & OfRun) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Runs the step `verify` of the ecosystem of OCI images, once semantic-release knows the version of
|
|
72
|
+
* the release: that the version and each tag that moves of it is a tag of an image, none given
|
|
73
|
+
* twice (`EOCIVERSION`), and that each image of the train has a repository (`EOCIIMAGE`). It asks
|
|
74
|
+
* the registry nothing. What it says and throws names the train.
|
|
75
|
+
*
|
|
76
|
+
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
77
|
+
* @param context - The context of semantic-release's `verifyRelease` step: the folder, the
|
|
78
|
+
* environment and the logger of the run, and the next release.
|
|
79
|
+
*/
|
|
80
|
+
export declare const verifyRelease: (pluginConfig: OciPluginOptions, context: VerifyReleaseContext & OfRun) => Promise<void>;
|
|
64
81
|
/**
|
|
65
|
-
* Copies the tested image of each image of the release to the tags of the release
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
82
|
+
* Copies the tested image of each image of the release to the tags of the release, by the steps
|
|
83
|
+
* `publish` and `move` of the ecosystem of OCI images, which `verifyRelease` verified: its version, skipped of a registry
|
|
84
|
+
* that has it at the same digest, so a release that stopped part way is finished by running it
|
|
85
|
+
* again; and of a release, its minor and its major, pointed at the version. Each image is given its
|
|
86
|
+
* page in the container registry of GitLab, asked by a token of `GL_TOKEN` or `GITLAB_TOKEN`, and
|
|
87
|
+
* recorded for the links of the release of the host; and the images it published are written to
|
|
88
|
+
* the dotenv file of `dotenv`.
|
|
69
89
|
*
|
|
70
90
|
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
71
91
|
* @param context - The context of semantic-release's `publish` step: the folder, the environment,
|
|
@@ -76,10 +96,11 @@ export declare function verifyConditions(pluginConfig: OciPluginOptions, context
|
|
|
76
96
|
* `EOCISMOKE` of a tested image the registry has not, `EOCIRETAG` of a version the registry has at
|
|
77
97
|
* another digest, `EOCITAG` of a copy crane cannot make, `EOCILINK` of a page GitLab cannot give.
|
|
78
98
|
*/
|
|
79
|
-
export declare
|
|
99
|
+
export declare const publish: (pluginConfig: OciPluginOptions, context: PublishContext & OfRun) => Promise<OciRelease | false>;
|
|
80
100
|
declare const _default: {
|
|
81
|
-
verifyConditions:
|
|
82
|
-
|
|
101
|
+
verifyConditions: (pluginConfig: OciPluginOptions, context: VerifyConditionsContext & OfRun) => Promise<void>;
|
|
102
|
+
verifyRelease: (pluginConfig: OciPluginOptions, context: VerifyReleaseContext & OfRun) => Promise<void>;
|
|
103
|
+
publish: (pluginConfig: OciPluginOptions, context: PublishContext & OfRun) => Promise<OciRelease | false>;
|
|
83
104
|
};
|
|
84
105
|
export default _default;
|
|
85
106
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AASjD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,kBAAkB,CAAA;AAKzB,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,sFAAsF;IACtF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9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UAAU,GAAG,KAAK,CA2D7B,CAAA;;qCAzJc,gBAAgB,WACrB,uBAAuB,GAAG,KAAK,KACrC,OAAO,CAAC,IAAI,CAAC;kCAyDF,gBAAgB,WACrB,oBAAoB,GAAG,KAAK,KAClC,OAAO,CAAC,IAAI,CAAC;4BA+BF,gBAAgB,WACrB,cAAc,GAAG,KAAK,KAC5B,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;;AA6DhC,wBAA2D"}
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,65 @@
|
|
|
1
|
-
import { packagesOfImages } from '@wtf/release-oci/ecosystem';
|
|
1
|
+
import { ociEcosystem, packagesOfImages } from '@wtf/release-oci/ecosystem';
|
|
2
2
|
import { OciError } from '@wtf/release-oci/errors';
|
|
3
3
|
import { readImages, registryImageOf } from '@wtf/release-oci/images';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { throwAll } from '@wtf/release
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { digestOf } from '@wtf/release-oci/publish';
|
|
5
|
+
import { checkRegistryAccess } from '@wtf/release-oci/registry';
|
|
6
|
+
import { runStep } from '@wtf/release/driver';
|
|
7
|
+
import { throwAll } from '@wtf/release/errors';
|
|
8
|
+
import { writeFile } from '@wtf/release/files';
|
|
9
|
+
import { joinPath } from '@wtf/release/posix';
|
|
10
|
+
import { errorsOf } from '@wtf/release/validator';
|
|
11
|
+
import { gitlabProjectOf } from '@wtf/release-trains/gitlab';
|
|
12
|
+
import { planOf } from '@wtf/release-trains/plan';
|
|
13
|
+
import { recordReleased } from '@wtf/semantic-release/links';
|
|
12
14
|
import { ownersOf } from '@wtf/release-trains/packages';
|
|
13
15
|
import { selectTrain, trainOfRun } from '@wtf/release-trains/trains';
|
|
16
|
+
import { runOf } from '@wtf/semantic-release';
|
|
17
|
+
import { markedStep } from '@wtf/semantic-release/errors';
|
|
18
|
+
import { inTrain, stepRelease } from '@wtf/semantic-release/release';
|
|
19
|
+
import semver from 'semver';
|
|
14
20
|
import { ociSchema } from "./schema.js";
|
|
15
|
-
/** The repository of the tested image of the image of `repository`, by its template. */
|
|
16
|
-
const sourceRepositoryOf = (template, repository) => template.replaceAll('{image}', repository);
|
|
17
21
|
/**
|
|
18
|
-
* The
|
|
22
|
+
* The tags of a release of `version`, as semantic-release's versions are: the version, and of a
|
|
23
|
+
* release, its minor and its major, which move, as `1.4` and `1` of `1.4.2`, which a consumer pins
|
|
24
|
+
* to take each fix of its line; of a release of the major `0`, its minor alone, as a minor of `0`
|
|
25
|
+
* breaks what the one before gave; of a prerelease, none that moves, so no moving tag points at a
|
|
26
|
+
* version that is not released.
|
|
27
|
+
*
|
|
28
|
+
* @param version - The version of the release, as `1.4.2`.
|
|
29
|
+
* @param moving - Whether a release moves its minor and its major: `true` by default.
|
|
30
|
+
* @returns The tags.
|
|
31
|
+
* @throws `TypeError` of a version that is no semver.
|
|
32
|
+
*/
|
|
33
|
+
function releaseTagsOf(version, moving = true) {
|
|
34
|
+
const parsed = semver.parse(version);
|
|
35
|
+
if (parsed === null)
|
|
36
|
+
throw new TypeError(`${version} is no semver version.`);
|
|
37
|
+
if (!moving || parsed.prerelease.length > 0)
|
|
38
|
+
return { version: parsed.version, moving: [] };
|
|
39
|
+
const minor = `${parsed.major}.${parsed.minor}`;
|
|
40
|
+
return {
|
|
41
|
+
version: parsed.version,
|
|
42
|
+
moving: parsed.major === 0 ? [minor] : [minor, `${parsed.major}`]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The folder and the platform of the run, Node's, its train, and the images of the repo and of the
|
|
47
|
+
* train.
|
|
19
48
|
*
|
|
20
49
|
* @param pluginConfig - The plugin's options of the config.
|
|
21
50
|
* @param context - The folder and the environment of the run.
|
|
22
51
|
* @returns What a step reads of the run.
|
|
23
52
|
*/
|
|
24
53
|
async function releaseOf(pluginConfig, context) {
|
|
25
|
-
const
|
|
54
|
+
const repo = await runOf(context);
|
|
26
55
|
const [train] = selectTrain(pluginConfig.trains, trainOfRun(pluginConfig.train, context.env));
|
|
27
|
-
const
|
|
28
|
-
const images = await readImages(git, pluginConfig.image ?? registryImageOf(git));
|
|
56
|
+
const images = await readImages(repo, pluginConfig.image ?? registryImageOf(repo));
|
|
29
57
|
const packages = packagesOfImages(images);
|
|
30
58
|
const owners = ownersOf(pluginConfig.trains, packages);
|
|
31
59
|
const selected = packages
|
|
32
60
|
.filter(({ name }) => owners.get(name) === train)
|
|
33
61
|
.map(({ image }) => image);
|
|
34
|
-
return {
|
|
62
|
+
return { repo, train, packages, selected };
|
|
35
63
|
}
|
|
36
64
|
/**
|
|
37
65
|
* The modules of the ecosystem of OCI images, as `ecosystems` of a config names it: this plugin's
|
|
@@ -69,6 +97,21 @@ function repositoriesOf(release) {
|
|
|
69
97
|
throwAll(errors);
|
|
70
98
|
return repositories;
|
|
71
99
|
}
|
|
100
|
+
/** The variables of a token of the API of GitLab, which the registry's API takes: no job token. */
|
|
101
|
+
const TOKEN_VARIABLES = ['GL_TOKEN', 'GITLAB_TOKEN'];
|
|
102
|
+
/**
|
|
103
|
+
* The headers the API of GitLab's container registry is asked by: a token of `GL_TOKEN` or
|
|
104
|
+
* `GITLAB_TOKEN`, as `PRIVATE-TOKEN`. Never the job token, `CI_JOB_TOKEN`, which that API refuses.
|
|
105
|
+
* Throws `EOCILINK` of a run of neither.
|
|
106
|
+
*/
|
|
107
|
+
function registryHeadersOf(env) {
|
|
108
|
+
const token = TOKEN_VARIABLES.map((name) => env[name]).find((value) => value !== undefined && value !== '');
|
|
109
|
+
if (token === undefined)
|
|
110
|
+
throw new OciError('EOCILINK', `The run has no ${TOKEN_VARIABLES.join(' nor ')}: the release links each image to its page in the container registry of GitLab, whose API refuses the job token.`, 'Give the run a token of the `read_api` or `api` scope as `GITLAB_TOKEN`, protected and masked, as semantic-release takes it to push the release.');
|
|
111
|
+
return { 'PRIVATE-TOKEN': token };
|
|
112
|
+
}
|
|
113
|
+
/** The project of the run on GitLab, of its environment and of the URL of the repo. */
|
|
114
|
+
const projectOf = (context) => gitlabProjectOf({}, context.env, context.options?.repositoryUrl);
|
|
72
115
|
/**
|
|
73
116
|
* Whether the train of the run has no image to tag, as a train of npm packages alone of a repo of
|
|
74
117
|
* several ecosystems, said in the log: each step of the plugin then does nothing.
|
|
@@ -83,25 +126,89 @@ function nothingOf(release, context) {
|
|
|
83
126
|
* Checks the options of the plugin, by `ociSchema` of `./schema` (`EOPTIONS`), that `ecosystems`
|
|
84
127
|
* lists `@wtf/semantic-release-oci/ecosystem` or `@wtf/release-oci` (`EOCIECOSYSTEM`), and the train
|
|
85
128
|
* of the run (`ETRAINNOTSELECTED`, `ETRAINUNKNOWN`); that no image is of two trains
|
|
86
|
-
* (`ETRAINOVERLAP`); and that each image of the train has a repository (`EOCIIMAGE`).
|
|
87
|
-
* registry
|
|
129
|
+
* (`ETRAINOVERLAP`); and that each image of the train has a repository (`EOCIIMAGE`). Then that
|
|
130
|
+
* the run may read the API of the container registry, which the links of `publish` need, by one
|
|
131
|
+
* request of no effect (`EOCILINK`): of a token of `GL_TOKEN` or `GITLAB_TOKEN`, which a dry run of
|
|
132
|
+
* none, as of a merge request, only warns of. It asks crane nothing.
|
|
88
133
|
*
|
|
89
134
|
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
90
135
|
* @param context - The context of semantic-release's `verifyConditions` step: the folder, the
|
|
91
136
|
* environment and the logger of the run.
|
|
92
137
|
*/
|
|
93
|
-
export
|
|
138
|
+
export const verifyConditions = markedStep(async (pluginConfig, context) => {
|
|
94
139
|
checkOptions(pluginConfig);
|
|
95
140
|
const release = await releaseOf(pluginConfig, context);
|
|
96
141
|
if (nothingOf(release, context))
|
|
97
142
|
return;
|
|
98
143
|
context.logger.log(`Train ${release.train} tags ${repositoriesOf(release).join(', ')}.`);
|
|
99
|
-
|
|
144
|
+
const dryRun = context.options?.dryRun === true;
|
|
145
|
+
let headers;
|
|
146
|
+
try {
|
|
147
|
+
headers = registryHeadersOf(context.env);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (!dryRun)
|
|
151
|
+
throw error;
|
|
152
|
+
context.logger.log(`${error.message} A release of this run would fail here.`);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
await checkRegistryAccess({
|
|
156
|
+
fetch: release.repo.platform.fetch,
|
|
157
|
+
project: projectOf(context),
|
|
158
|
+
headers
|
|
159
|
+
});
|
|
160
|
+
});
|
|
100
161
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
162
|
+
* The plan of the release of the train of `release`, of `version`, by `planOf` of
|
|
163
|
+
* `@wtf/release-trains/plan`: the images of the train, of their own type.
|
|
164
|
+
*
|
|
165
|
+
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
166
|
+
* @param release - What the step read of the run.
|
|
167
|
+
* @param version - The version of the release.
|
|
168
|
+
* @returns The plan of the images, by the name of the ecosystem.
|
|
169
|
+
*/
|
|
170
|
+
const plansOf = (pluginConfig, release, version) => planOf({
|
|
171
|
+
trains: pluginConfig.trains,
|
|
172
|
+
train: release.train,
|
|
173
|
+
version,
|
|
174
|
+
repo: [{ ecosystem: ociEcosystem, packages: release.packages }],
|
|
175
|
+
...release.repo
|
|
176
|
+
});
|
|
177
|
+
/**
|
|
178
|
+
* The tags that move to `version`, of the option `moving`: of a release, its minor and its major;
|
|
179
|
+
* none of a prerelease, or where the option is false.
|
|
180
|
+
*/
|
|
181
|
+
const movingOf = (pluginConfig, version) => releaseTagsOf(version, pluginConfig.moving ?? true).moving;
|
|
182
|
+
/**
|
|
183
|
+
* Runs the step `verify` of the ecosystem of OCI images, once semantic-release knows the version of
|
|
184
|
+
* the release: that the version and each tag that moves of it is a tag of an image, none given
|
|
185
|
+
* twice (`EOCIVERSION`), and that each image of the train has a repository (`EOCIIMAGE`). It asks
|
|
186
|
+
* the registry nothing. What it says and throws names the train.
|
|
187
|
+
*
|
|
188
|
+
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
189
|
+
* @param context - The context of semantic-release's `verifyRelease` step: the folder, the
|
|
190
|
+
* environment and the logger of the run, and the next release.
|
|
191
|
+
*/
|
|
192
|
+
export const verifyRelease = markedStep(async (pluginConfig, context) => {
|
|
193
|
+
const { version } = context.nextRelease;
|
|
194
|
+
const release = await releaseOf(pluginConfig, context);
|
|
195
|
+
if (nothingOf(release, context))
|
|
196
|
+
return;
|
|
197
|
+
await inTrain(release.train, async () => {
|
|
198
|
+
const of = stepRelease(context, { ...release.repo, train: release.train, version });
|
|
199
|
+
const plans = await plansOf(pluginConfig, release, version);
|
|
200
|
+
const options = { moving: movingOf(pluginConfig, version) };
|
|
201
|
+
await runStep(of, plans, [[ociEcosystem, options]], 'verify');
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
/**
|
|
205
|
+
* Copies the tested image of each image of the release to the tags of the release, by the steps
|
|
206
|
+
* `publish` and `move` of the ecosystem of OCI images, which `verifyRelease` verified: its version, skipped of a registry
|
|
207
|
+
* that has it at the same digest, so a release that stopped part way is finished by running it
|
|
208
|
+
* again; and of a release, its minor and its major, pointed at the version. Each image is given its
|
|
209
|
+
* page in the container registry of GitLab, asked by a token of `GL_TOKEN` or `GITLAB_TOKEN`, and
|
|
210
|
+
* recorded for the links of the release of the host; and the images it published are written to
|
|
211
|
+
* the dotenv file of `dotenv`.
|
|
105
212
|
*
|
|
106
213
|
* @param pluginConfig - The plugin's options of the config, with `trains` of its root.
|
|
107
214
|
* @param context - The context of semantic-release's `publish` step: the folder, the environment,
|
|
@@ -112,7 +219,7 @@ export async function verifyConditions(pluginConfig, context) {
|
|
|
112
219
|
* `EOCISMOKE` of a tested image the registry has not, `EOCIRETAG` of a version the registry has at
|
|
113
220
|
* another digest, `EOCITAG` of a copy crane cannot make, `EOCILINK` of a page GitLab cannot give.
|
|
114
221
|
*/
|
|
115
|
-
export
|
|
222
|
+
export const publish = markedStep(async (pluginConfig, context) => {
|
|
116
223
|
const { version } = context.nextRelease;
|
|
117
224
|
const release = await releaseOf(pluginConfig, context);
|
|
118
225
|
const run = { cwd: context.cwd, train: release.train, version };
|
|
@@ -120,46 +227,47 @@ export async function publish(pluginConfig, context) {
|
|
|
120
227
|
recordReleased(run, 'oci', []);
|
|
121
228
|
return false;
|
|
122
229
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
crane: pluginConfig.crane
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
version
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
230
|
+
return inTrain(release.train, async () => {
|
|
231
|
+
// Each image of a repository (`EOCIIMAGE`), before anything is asked.
|
|
232
|
+
repositoriesOf(release);
|
|
233
|
+
// The token of the links, before anything is copied: a run of none fails here, not after.
|
|
234
|
+
const headers = registryHeadersOf(context.env);
|
|
235
|
+
const tag = pluginConfig.sourceTag ?? context.env['CI_COMMIT_REF_SLUG'];
|
|
236
|
+
if (tag === undefined || tag === '')
|
|
237
|
+
throw new OciError('EOCISOURCE', `The tested image of train ${release.train} has no tag: neither the option \`sourceTag\` nor \`CI_COMMIT_REF_SLUG\` of the run names it.`, 'Run the release in the pipeline of its tag, which gives `CI_COMMIT_REF_SLUG`, or give the plugin the option `sourceTag`, the tag the pipeline pushes the tested image as.');
|
|
238
|
+
const { platform, root } = release.repo;
|
|
239
|
+
const plans = await plansOf(pluginConfig, release, version);
|
|
240
|
+
const options = {
|
|
241
|
+
moving: movingOf(pluginConfig, version),
|
|
242
|
+
source: { repository: pluginConfig.sourceRepository ?? '{image}/snapshot', tag },
|
|
243
|
+
platforms: pluginConfig.platforms,
|
|
244
|
+
crane: pluginConfig.crane,
|
|
245
|
+
registry: { project: projectOf(context), headers }
|
|
246
|
+
};
|
|
247
|
+
const of = stepRelease(context, { ...release.repo, train: release.train, version });
|
|
248
|
+
const { dryRun } = of;
|
|
249
|
+
const ecosystems = [[ociEcosystem, options]];
|
|
250
|
+
const { released } = await runStep(of, plans, ecosystems, 'publish');
|
|
251
|
+
await runStep(of, plans, ecosystems, 'move');
|
|
252
|
+
recordReleased(run, 'oci', released);
|
|
253
|
+
if (pluginConfig.dotenv !== false && !dryRun) {
|
|
254
|
+
const path = pluginConfig.dotenv ?? 'oci.env';
|
|
255
|
+
const file = joinPath(platform.dirs.cwd, path);
|
|
256
|
+
const crane = { platform, crane: pluginConfig.crane };
|
|
257
|
+
const images = await Promise.all(released.map(async ({ name }) => `${name}@${await digestOf(`${name}:${version}`, crane)}`));
|
|
258
|
+
await writeFile(root, path, [
|
|
259
|
+
`oci_version=${version}`,
|
|
260
|
+
`oci_images=${images.join(' ')}`,
|
|
261
|
+
`oci_tags=${released.length === 0 ? '' : [version, ...options.moving].join(' ')}`
|
|
262
|
+
].join('\n') + '\n');
|
|
263
|
+
of.log(`Wrote the images published to ${file}.`);
|
|
264
|
+
}
|
|
265
|
+
const [first] = released;
|
|
266
|
+
return {
|
|
267
|
+
name: `OCI images (${released.map(({ name }) => `${name}:${version}`).join(', ')})`,
|
|
268
|
+
...(first?.page === undefined ? {} : { url: first.page })
|
|
269
|
+
};
|
|
146
270
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const headers = gitlabHeadersOf(context.env);
|
|
150
|
-
const pages = await Promise.all(published.map(({ repository }) => registryPageOf({ fetch: fetch, project, repository, headers })));
|
|
151
|
-
const released = published.map(({ repository }, index) => ({
|
|
152
|
-
ecosystem: 'oci',
|
|
153
|
-
name: repository,
|
|
154
|
-
version,
|
|
155
|
-
page: pages[index]
|
|
156
|
-
}));
|
|
157
|
-
recordReleased(run, 'oci', released);
|
|
158
|
-
const [first] = released;
|
|
159
|
-
return {
|
|
160
|
-
name: `OCI images (${published.map(({ repository }) => `${repository}:${version}`).join(', ')})`,
|
|
161
|
-
...(first?.page === undefined ? {} : { url: first.page })
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export default { verifyConditions, publish };
|
|
271
|
+
});
|
|
272
|
+
export default { verifyConditions, verifyRelease, publish };
|
|
165
273
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkDA,OAAO,EACL,YAAY,EAGZ,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAG/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAsB,MAAM,4BAA4B,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,M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AAC,CAAA;AAEF,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The schema of the options of the plugin, as validators of `@wtf/release
|
|
2
|
+
* The schema of the options of the plugin, as validators of `@wtf/release/validator`: each a
|
|
3
3
|
* Standard Schema, and a Standard JSON Schema of the JSON Schema of what it checks.
|
|
4
4
|
*
|
|
5
5
|
* - {@link ociSchema}: the options the plugin is given, of the root of the config, `trains`,
|
|
6
|
-
* `ecosystems
|
|
6
|
+
* `ecosystems` and `train`, and of its entry, as it checks them;
|
|
7
7
|
* - {@link ociOptionsSchema}: the options of its entry, `image`, `sourceRepository`, `sourceTag`,
|
|
8
|
-
* `moving`, `platforms` and `
|
|
8
|
+
* `moving`, `platforms`, `crane` and `dotenv`, its own;
|
|
9
9
|
* - {@link configSchema}: this package's part of a whole config of semantic-release, each entry of
|
|
10
10
|
* `plugins` of the plugin, and anything else; its JSON Schema is {@link jsonSchema}, which the
|
|
11
11
|
* package publishes as `schema.json`.
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
* @packageDocumentation
|
|
23
23
|
* @module @wtf/semantic-release-oci/schema
|
|
24
24
|
*/
|
|
25
|
-
import { type JsonSchema, type Validator } from '@wtf/release
|
|
25
|
+
import { type JsonSchema, type Validator } from '@wtf/release/validator';
|
|
26
26
|
import { type RootOptions } from '@wtf/release-trains/schema';
|
|
27
27
|
import type { OciPluginOptions } from './index.ts';
|
|
28
28
|
/** The options of an entry of the plugin, its own: every one of the options but those of the root. */
|
|
29
|
-
export type OciOptions = Omit<OciPluginOptions, 'train' | 'trains' | 'ecosystems'
|
|
29
|
+
export type OciOptions = Omit<OciPluginOptions, 'train' | 'trains' | 'ecosystems'>;
|
|
30
30
|
/** The validator of the options of an entry of the plugin, its own. */
|
|
31
31
|
export declare const ociOptionsSchema: Validator<OciOptions>;
|
|
32
32
|
/**
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAKL,KAAK,UAAU,EAIf,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,sGAAsG;AACtG,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAA;AAElF,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,UAAU,CAcjD,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,UAAU,CAGzD,CAAA;AAED,wGAAwG;AACxG,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,MAAM,CAG1C,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,UAAU,EAAE,UAOxB,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The schema of the options of the plugin, as validators of `@wtf/release
|
|
2
|
+
* The schema of the options of the plugin, as validators of `@wtf/release/validator`: each a
|
|
3
3
|
* Standard Schema, and a Standard JSON Schema of the JSON Schema of what it checks.
|
|
4
4
|
*
|
|
5
5
|
* - {@link ociSchema}: the options the plugin is given, of the root of the config, `trains`,
|
|
6
|
-
* `ecosystems
|
|
6
|
+
* `ecosystems` and `train`, and of its entry, as it checks them;
|
|
7
7
|
* - {@link ociOptionsSchema}: the options of its entry, `image`, `sourceRepository`, `sourceTag`,
|
|
8
|
-
* `moving`, `platforms` and `
|
|
8
|
+
* `moving`, `platforms`, `crane` and `dotenv`, its own;
|
|
9
9
|
* - {@link configSchema}: this package's part of a whole config of semantic-release, each entry of
|
|
10
10
|
* `plugins` of the plugin, and anything else; its JSON Schema is {@link jsonSchema}, which the
|
|
11
11
|
* package publishes as `schema.json`.
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
* @packageDocumentation
|
|
23
23
|
* @module @wtf/semantic-release-oci/schema
|
|
24
24
|
*/
|
|
25
|
-
import { allOf, arrayOf, booleanOf, objectOf,
|
|
25
|
+
import { allOf, anyOf, arrayOf, booleanOf, objectOf, oneOf, stringOf } from '@wtf/release/validator';
|
|
26
26
|
import { rootOptionsSchema } from '@wtf/release-trains/schema';
|
|
27
|
+
import { pluginEntriesOf } from '@wtf/semantic-release/schema';
|
|
27
28
|
/** The validator of the options of an entry of the plugin, its own. */
|
|
28
29
|
export const ociOptionsSchema = objectOf({
|
|
29
30
|
image: { of: stringOf({ minLength: 1 }), optional: true },
|
|
@@ -31,7 +32,11 @@ export const ociOptionsSchema = objectOf({
|
|
|
31
32
|
sourceTag: { of: stringOf({ minLength: 1 }), optional: true },
|
|
32
33
|
moving: { of: booleanOf(), optional: true },
|
|
33
34
|
platforms: { of: arrayOf(stringOf({ minLength: 1 })), optional: true },
|
|
34
|
-
crane: { of: stringOf({ minLength: 1 }), optional: true }
|
|
35
|
+
crane: { of: stringOf({ minLength: 1 }), optional: true },
|
|
36
|
+
dotenv: {
|
|
37
|
+
of: anyOf([stringOf({ minLength: 1 }), oneOf([false])], 'a file, or false'),
|
|
38
|
+
optional: true
|
|
39
|
+
}
|
|
35
40
|
});
|
|
36
41
|
/**
|
|
37
42
|
* The validator of the options the plugin is given: the root's, `trains` and `ecosystems` required,
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EACL,KAAK,EACL,OAAO,EACP,SAAS,EAET,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EAET,QAAQ,EACR,KAAK,EACL,QAAQ,EAET,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAoB,MAAM,4BAA4B,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAO9D,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAA0B,QAAQ,CAAa;IAC1E,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzD,gBAAgB,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpE,SAAS,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7D,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,SAAS,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzD,MAAM,EAAE;QACN,EAAE,EAAE,KAAK,CACP,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CAAU,CAAC,CAAC,EACrD,kBAAkB,CACnB;QACD,QAAQ,EAAE,IAAI;KACf;CACF,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAwC,KAAK,CACjE,iBAAiB,EACjB,gBAAgB,CACjB,CAAA;AAED,wGAAwG;AACxG,MAAM,CAAC,MAAM,YAAY,GAAsB,eAAe,CAC5D,CAAC,2BAA2B,CAAC,EAC7B,gBAAgB,CACjB,CAAA;AAED,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,OAAO,EAAE,8CAA8C;IACvD,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE,2BAA2B;IAClC,WAAW,EACT,8LAA8L;IAChM,GAAG,YAAY,CAAC,UAAU;CAC3B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wtf/semantic-release-oci",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "The plugin of semantic-release that releases the OCI images of a train of a repo, by @wtf/release-oci, with no rebuild: in publish, the tested image of each, by default the snapshot of the pipeline of the tag, found by its digest and copied by crane to the tags of the release, its version and, of a release, its moving minor and major, a full version the registry has at the same digest skipped and at another refused, so a release that stopped part way is finished by running it again; each image linked to its page in the container registry of GitLab; and the schema of its options and of its part of a config (./schema, schema.json).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"container",
|
|
@@ -53,12 +53,16 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@standard-schema/spec": "^1.1.0",
|
|
56
|
-
"@wtf/
|
|
57
|
-
"@wtf/release
|
|
58
|
-
"@wtf/release-
|
|
56
|
+
"@wtf/platform": "^1.0.0",
|
|
57
|
+
"@wtf/release": "^1.0.0",
|
|
58
|
+
"@wtf/release-oci": "^3.0.0",
|
|
59
|
+
"@wtf/release-trains": "^9.0.0",
|
|
60
|
+
"@wtf/semantic-release": "^1.0.0",
|
|
61
|
+
"semver": "^7.7.0"
|
|
59
62
|
},
|
|
60
63
|
"devDependencies": {
|
|
61
64
|
"@types/node": "^24.10.0",
|
|
65
|
+
"@types/semver": "^7.7.0",
|
|
62
66
|
"semantic-release": "^25.0.9",
|
|
63
67
|
"vitest": "^5.0.5"
|
|
64
68
|
},
|