semantic-release 23.0.0-beta.3 → 23.0.0-beta.5
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 +3 -3
- package/docs/support/node-version.md +1 -1
- package/index.js +7 -4
- package/lib/git.js +39 -10
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -110,9 +110,9 @@ In order to use **semantic-release** you need:
|
|
|
110
110
|
## Documentation
|
|
111
111
|
|
|
112
112
|
- Usage
|
|
113
|
-
- [Getting started](docs/usage/getting-started.md
|
|
114
|
-
- [Installation](docs/usage/installation.md
|
|
115
|
-
- [CI Configuration](docs/usage/ci-configuration.md
|
|
113
|
+
- [Getting started](docs/usage/getting-started.md)
|
|
114
|
+
- [Installation](docs/usage/installation.md)
|
|
115
|
+
- [CI Configuration](docs/usage/ci-configuration.md)
|
|
116
116
|
- [Configuration](docs/usage/configuration.md#configuration)
|
|
117
117
|
- [Plugins](docs/usage/plugins.md)
|
|
118
118
|
- [Workflow configuration](docs/usage/workflow-configuration.md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Node version requirement
|
|
2
2
|
|
|
3
|
-
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which **requires Node version
|
|
3
|
+
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which **requires Node version 20.8.1 or higher**.
|
|
4
4
|
|
|
5
5
|
**semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency.
|
|
6
6
|
Therefore, the only constraint is to run the `semantic-release` in a CI environment providing version of Node that meets our version requirement.
|
package/index.js
CHANGED
|
@@ -123,12 +123,15 @@ async function run(context, plugins) {
|
|
|
123
123
|
if (options.dryRun) {
|
|
124
124
|
logger.warn(`Skip ${nextRelease.gitTag} tag creation in dry-run mode`);
|
|
125
125
|
} else {
|
|
126
|
-
await addNote({ channels: [...currentRelease.channels, nextRelease.channel] }, nextRelease.
|
|
126
|
+
await addNote({ channels: [...currentRelease.channels, nextRelease.channel] }, nextRelease.gitTag, {
|
|
127
127
|
cwd,
|
|
128
128
|
env,
|
|
129
129
|
});
|
|
130
130
|
await push(options.repositoryUrl, { cwd, env });
|
|
131
|
-
await pushNotes(options.repositoryUrl,
|
|
131
|
+
await pushNotes(options.repositoryUrl, nextRelease.gitTag, {
|
|
132
|
+
cwd,
|
|
133
|
+
env,
|
|
134
|
+
});
|
|
132
135
|
logger.success(
|
|
133
136
|
`Add ${nextRelease.channel ? `channel ${nextRelease.channel}` : "default channel"} to tag ${
|
|
134
137
|
nextRelease.gitTag
|
|
@@ -203,9 +206,9 @@ async function run(context, plugins) {
|
|
|
203
206
|
} else {
|
|
204
207
|
// Create the tag before calling the publish plugins as some require the tag to exists
|
|
205
208
|
await tag(nextRelease.gitTag, nextRelease.gitHead, { cwd, env });
|
|
206
|
-
await addNote({ channels: [nextRelease.channel] }, nextRelease.
|
|
209
|
+
await addNote({ channels: [nextRelease.channel] }, nextRelease.gitTag, { cwd, env });
|
|
207
210
|
await push(options.repositoryUrl, { cwd, env });
|
|
208
|
-
await pushNotes(options.repositoryUrl, { cwd, env });
|
|
211
|
+
await pushNotes(options.repositoryUrl, nextRelease.gitTag, { cwd, env });
|
|
209
212
|
logger.success(`Created tag ${nextRelease.gitTag}`);
|
|
210
213
|
}
|
|
211
214
|
|
package/lib/git.js
CHANGED
|
@@ -2,6 +2,7 @@ import gitLogParser from "git-log-parser";
|
|
|
2
2
|
import getStream from "get-stream";
|
|
3
3
|
import { execa } from "execa";
|
|
4
4
|
import debugGit from "debug";
|
|
5
|
+
import { merge } from "lodash-es";
|
|
5
6
|
import { GIT_NOTE_REF } from "./definitions/constants.js";
|
|
6
7
|
|
|
7
8
|
const debug = debugGit("semantic-release:git");
|
|
@@ -141,13 +142,9 @@ export async function fetch(repositoryUrl, branch, ciBranch, execaOptions) {
|
|
|
141
142
|
*/
|
|
142
143
|
export async function fetchNotes(repositoryUrl, execaOptions) {
|
|
143
144
|
try {
|
|
144
|
-
await execa(
|
|
145
|
-
"git",
|
|
146
|
-
["fetch", "--unshallow", repositoryUrl, `+refs/notes/${GIT_NOTE_REF}:refs/notes/${GIT_NOTE_REF}`],
|
|
147
|
-
execaOptions
|
|
148
|
-
);
|
|
145
|
+
await execa("git", ["fetch", "--unshallow", repositoryUrl, `+refs/notes/*:refs/notes/*`], execaOptions);
|
|
149
146
|
} catch {
|
|
150
|
-
await execa("git", ["fetch", repositoryUrl, `+refs/notes
|
|
147
|
+
await execa("git", ["fetch", repositoryUrl, `+refs/notes/*:refs/notes/*`], {
|
|
151
148
|
...execaOptions,
|
|
152
149
|
reject: false,
|
|
153
150
|
});
|
|
@@ -246,8 +243,8 @@ export async function push(repositoryUrl, execaOptions) {
|
|
|
246
243
|
*
|
|
247
244
|
* @throws {Error} if the push failed.
|
|
248
245
|
*/
|
|
249
|
-
export async function pushNotes(repositoryUrl, execaOptions) {
|
|
250
|
-
await execa("git", ["push", repositoryUrl, `refs/notes/${GIT_NOTE_REF}`], execaOptions);
|
|
246
|
+
export async function pushNotes(repositoryUrl, ref, execaOptions) {
|
|
247
|
+
await execa("git", ["push", repositoryUrl, `refs/notes/${GIT_NOTE_REF}-${ref}`], execaOptions);
|
|
251
248
|
}
|
|
252
249
|
|
|
253
250
|
/**
|
|
@@ -307,8 +304,26 @@ export async function isBranchUpToDate(repositoryUrl, branch, execaOptions) {
|
|
|
307
304
|
* @return {Object} the parsed JSON note if there is one, an empty object otherwise.
|
|
308
305
|
*/
|
|
309
306
|
export async function getNote(ref, execaOptions) {
|
|
307
|
+
const handleError = (error) => {
|
|
308
|
+
if (error.exitCode === 1) {
|
|
309
|
+
return { stdout: "{}" };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
debug(error);
|
|
313
|
+
throw error;
|
|
314
|
+
};
|
|
315
|
+
|
|
310
316
|
try {
|
|
311
|
-
return
|
|
317
|
+
return merge(
|
|
318
|
+
JSON.parse(
|
|
319
|
+
// Used for retro-compatibility
|
|
320
|
+
(await execa("git", ["notes", "--ref", GIT_NOTE_REF, "show", ref], execaOptions).catch(handleError)).stdout
|
|
321
|
+
),
|
|
322
|
+
JSON.parse(
|
|
323
|
+
(await execa("git", ["notes", "--ref", `${GIT_NOTE_REF}-${ref}`, "show", ref], execaOptions).catch(handleError))
|
|
324
|
+
.stdout
|
|
325
|
+
)
|
|
326
|
+
);
|
|
312
327
|
} catch (error) {
|
|
313
328
|
if (error.exitCode === 1) {
|
|
314
329
|
return {};
|
|
@@ -327,5 +342,19 @@ export async function getNote(ref, execaOptions) {
|
|
|
327
342
|
* @param {Object} [execaOpts] Options to pass to `execa`.
|
|
328
343
|
*/
|
|
329
344
|
export async function addNote(note, ref, execaOptions) {
|
|
330
|
-
await execa(
|
|
345
|
+
await execa(
|
|
346
|
+
"git",
|
|
347
|
+
["notes", "--ref", `${GIT_NOTE_REF}-${ref}`, "add", "-f", "-m", JSON.stringify(note), ref],
|
|
348
|
+
execaOptions
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Get the reference of a tag
|
|
354
|
+
*
|
|
355
|
+
* @param {String} tag The tag name to get the reference of.
|
|
356
|
+
* @param {Object} [execaOpts] Options to pass to `execa`.
|
|
357
|
+
**/
|
|
358
|
+
export async function getTagRef(tag, execaOptions) {
|
|
359
|
+
return (await execa("git", ["show-ref", tag, "--hash"], execaOptions)).stdout;
|
|
331
360
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release",
|
|
3
3
|
"description": "Automated semver compliant package publishing",
|
|
4
|
-
"version": "23.0.0-beta.
|
|
4
|
+
"version": "23.0.0-beta.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
|
|
7
7
|
"ava": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"hosted-git-info": "^7.0.0",
|
|
46
46
|
"import-from-esm": "^1.3.1",
|
|
47
47
|
"lodash-es": "^4.17.21",
|
|
48
|
-
"marked": "^
|
|
48
|
+
"marked": "^11.0.0",
|
|
49
49
|
"marked-terminal": "^6.0.0",
|
|
50
50
|
"micromatch": "^4.0.2",
|
|
51
51
|
"p-each-series": "^3.0.0",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"ava": "6.0.1",
|
|
62
|
-
"c8": "
|
|
62
|
+
"c8": "9.0.0",
|
|
63
63
|
"clear-module": "4.1.2",
|
|
64
64
|
"codecov": "3.8.3",
|
|
65
65
|
"cz-conventional-changelog": "3.3.0",
|
|
66
|
-
"dockerode": "4.0.
|
|
66
|
+
"dockerode": "4.0.2",
|
|
67
67
|
"file-url": "4.0.0",
|
|
68
68
|
"fs-extra": "11.2.0",
|
|
69
69
|
"got": "14.0.0",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"mockserver-client": "5.15.0",
|
|
74
74
|
"nock": "13.4.0",
|
|
75
75
|
"npm-run-all2": "6.1.1",
|
|
76
|
-
"p-retry": "6.
|
|
76
|
+
"p-retry": "6.2.0",
|
|
77
77
|
"prettier": "3.1.1",
|
|
78
|
-
"publint": "0.2.
|
|
78
|
+
"publint": "0.2.7",
|
|
79
79
|
"sinon": "17.0.1",
|
|
80
80
|
"stream-buffers": "3.0.2",
|
|
81
81
|
"tempy": "3.1.0",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
},
|
|
160
160
|
"renovate": {
|
|
161
161
|
"extends": [
|
|
162
|
-
"github>semantic-release/.github"
|
|
162
|
+
"github>semantic-release/.github:renovate-config"
|
|
163
163
|
]
|
|
164
164
|
}
|
|
165
165
|
}
|