@ucdjs/release-scripts 0.1.0-beta.28 ā 0.1.0-beta.29
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.mjs +37 -26
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -344,6 +344,14 @@ var GitService = class extends Effect.Service()("@ucdjs/release-scripts/GitServi
|
|
|
344
344
|
message
|
|
345
345
|
]);
|
|
346
346
|
}
|
|
347
|
+
function writeEmptyCommit(message) {
|
|
348
|
+
return execGitCommandIfNotDry([
|
|
349
|
+
"commit",
|
|
350
|
+
"--allow-empty",
|
|
351
|
+
"-m",
|
|
352
|
+
message
|
|
353
|
+
]);
|
|
354
|
+
}
|
|
347
355
|
function pushChanges(branch, remote = "origin") {
|
|
348
356
|
return execGitCommandIfNotDry([
|
|
349
357
|
"push",
|
|
@@ -459,6 +467,7 @@ var GitService = class extends Effect.Service()("@ucdjs/release-scripts/GitServi
|
|
|
459
467
|
commits: {
|
|
460
468
|
stage: stageChanges,
|
|
461
469
|
write: writeCommit,
|
|
470
|
+
writeEmpty: writeEmptyCommit,
|
|
462
471
|
push: pushChanges,
|
|
463
472
|
forcePush: forcePushChanges,
|
|
464
473
|
get: getCommits,
|
|
@@ -1179,34 +1188,23 @@ function constructPrepareProgram(config) {
|
|
|
1179
1188
|
const versionCalculator = yield* VersionCalculatorService;
|
|
1180
1189
|
const workspace = yield* WorkspaceService;
|
|
1181
1190
|
yield* git.workspace.assertWorkspaceReady;
|
|
1182
|
-
|
|
1191
|
+
let releasePullRequest = yield* github.getPullRequestByBranch(config.branch.release);
|
|
1192
|
+
const isNewRelease = !releasePullRequest;
|
|
1193
|
+
const branchExists = yield* git.branches.exists(config.branch.release);
|
|
1194
|
+
if (!branchExists) {
|
|
1183
1195
|
yield* Console.log(`šæ Creating release branch "${config.branch.release}" from "${config.branch.default}"...`);
|
|
1184
1196
|
yield* git.branches.create(config.branch.release, config.branch.default);
|
|
1185
1197
|
yield* Console.log(`ā
Release branch created.`);
|
|
1186
1198
|
}
|
|
1187
|
-
let releasePullRequest = yield* github.getPullRequestByBranch(config.branch.release);
|
|
1188
|
-
if (!releasePullRequest) {
|
|
1189
|
-
yield* Console.log(`š Creating release pull request...`);
|
|
1190
|
-
yield* git.branches.checkout(config.branch.release);
|
|
1191
|
-
yield* git.commits.push(config.branch.release);
|
|
1192
|
-
releasePullRequest = yield* github.createPullRequest({
|
|
1193
|
-
title: config.pullRequest.title,
|
|
1194
|
-
body: config.pullRequest.body,
|
|
1195
|
-
head: config.branch.release,
|
|
1196
|
-
base: config.branch.default,
|
|
1197
|
-
draft: true
|
|
1198
|
-
});
|
|
1199
|
-
yield* Console.log(`ā
Release pull request #${releasePullRequest.number} created.`);
|
|
1200
|
-
}
|
|
1201
|
-
if (!releasePullRequest.head) return yield* Effect.fail(/* @__PURE__ */ new Error(`Release pull request for branch "${config.branch.release}" has no head SHA.`));
|
|
1202
|
-
yield* Console.log(`ā
Release pull request #${releasePullRequest.number} exists.`);
|
|
1203
1199
|
if ((yield* git.branches.get) !== config.branch.release) {
|
|
1204
1200
|
yield* git.branches.checkout(config.branch.release);
|
|
1205
1201
|
yield* Console.log(`ā
Checked out to release branch "${config.branch.release}".`);
|
|
1206
1202
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1203
|
+
if (!isNewRelease || branchExists) {
|
|
1204
|
+
yield* Console.log(`š Rebasing "${config.branch.release}" onto "${config.branch.default}"...`);
|
|
1205
|
+
yield* git.branches.rebase(config.branch.default);
|
|
1206
|
+
yield* Console.log(`ā
Rebase complete.`);
|
|
1207
|
+
}
|
|
1210
1208
|
const overrides = yield* loadOverrides({
|
|
1211
1209
|
sha: config.branch.default,
|
|
1212
1210
|
overridesPath: ".github/ucdjs-release.overrides.json"
|
|
@@ -1249,17 +1247,30 @@ ${releases.map((r) => ` - ${r.package.name}@${r.newVersion}`).join("\n")}`;
|
|
|
1249
1247
|
yield* Console.log("š¾ Creating commit...");
|
|
1250
1248
|
yield* git.commits.write(commitMessage);
|
|
1251
1249
|
yield* Console.log("ā
Commit created.");
|
|
1252
|
-
yield* Console.log(`ā¬ļø
|
|
1253
|
-
yield* git.commits.
|
|
1254
|
-
yield*
|
|
1255
|
-
yield* Console.log(
|
|
1250
|
+
yield* Console.log(`ā¬ļø Pushing to "${config.branch.release}"...`);
|
|
1251
|
+
if (isNewRelease && !branchExists) yield* git.commits.push(config.branch.release);
|
|
1252
|
+
else yield* git.commits.forcePush(config.branch.release);
|
|
1253
|
+
yield* Console.log(`ā
Push complete.`);
|
|
1256
1254
|
const prBody = yield* github.generateReleasePRBody(releases.map((r) => ({
|
|
1257
1255
|
packageName: r.package.name,
|
|
1258
1256
|
version: r.newVersion,
|
|
1259
1257
|
previousVersion: r.package.version
|
|
1260
1258
|
})));
|
|
1261
|
-
|
|
1262
|
-
|
|
1259
|
+
if (isNewRelease) {
|
|
1260
|
+
yield* Console.log("š Creating release pull request...");
|
|
1261
|
+
releasePullRequest = yield* github.createPullRequest({
|
|
1262
|
+
title: config.pullRequest.title,
|
|
1263
|
+
body: prBody,
|
|
1264
|
+
head: config.branch.release,
|
|
1265
|
+
base: config.branch.default,
|
|
1266
|
+
draft: true
|
|
1267
|
+
});
|
|
1268
|
+
yield* Console.log(`ā
Release pull request #${releasePullRequest.number} created.`);
|
|
1269
|
+
} else {
|
|
1270
|
+
yield* Console.log("š Updating pull request...");
|
|
1271
|
+
yield* github.updatePullRequest(releasePullRequest.number, { body: prBody });
|
|
1272
|
+
yield* Console.log("ā
Pull request updated.");
|
|
1273
|
+
}
|
|
1263
1274
|
yield* Console.log(`\nš Release preparation complete! View PR: #${releasePullRequest.number}`);
|
|
1264
1275
|
});
|
|
1265
1276
|
}
|