@pubm/plugin-brew 0.4.11 → 0.4.12
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.js +73 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -318,22 +318,26 @@ function brewCore(options) {
|
|
|
318
318
|
`git commit -m "${name} ${releaseCtx.version}"`,
|
|
319
319
|
`git push origin ${branchName}`
|
|
320
320
|
].join(" && "), { stdio: "inherit" });
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
321
|
+
try {
|
|
322
|
+
const prUrl = execSync2([
|
|
323
|
+
`cd ${tmpDir}`,
|
|
324
|
+
`gh pr create --repo homebrew/homebrew-core --title "${name} ${releaseCtx.version}" --body "Update ${name} formula to version ${releaseCtx.version}"`
|
|
325
|
+
].join(" && "), { encoding: "utf-8", ...ghEnv }).trim();
|
|
326
|
+
const prNumber = prUrl.match(/\/pull\/(\d+)/)?.[1];
|
|
327
|
+
if (prNumber) {
|
|
328
|
+
ctx.runtime.rollback.add({
|
|
329
|
+
label: `Close homebrew-core PR #${prNumber}`,
|
|
330
|
+
fn: async () => {
|
|
331
|
+
const { execSync: execSyncRb } = await import("node:child_process");
|
|
332
|
+
execSyncRb(`gh pr close ${prNumber} --repo homebrew/homebrew-core --comment "Closed by pubm rollback"`, { stdio: "inherit", ...ghEnv });
|
|
333
|
+
},
|
|
334
|
+
confirm: true
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
console.log(`PR created to homebrew/homebrew-core for ${name} ${releaseCtx.version}`);
|
|
338
|
+
} catch {
|
|
339
|
+
console.warn(`⚠ Failed to create PR. Push succeeded to branch: ${branchName}`);
|
|
335
340
|
}
|
|
336
|
-
console.log(`PR created to homebrew/homebrew-core for ${name} ${releaseCtx.version}`);
|
|
337
341
|
}
|
|
338
342
|
}
|
|
339
343
|
};
|
|
@@ -475,24 +479,35 @@ function brewTap(options) {
|
|
|
475
479
|
ensureGitIdentity();
|
|
476
480
|
execSync2(`git add ${formulaPath}`, { stdio: "inherit" });
|
|
477
481
|
execSync2(`git commit -m "chore(brew): update formula to ${releaseCtx.version}"`, { stdio: "inherit" });
|
|
482
|
+
const token = ctx.runtime?.pluginTokens?.["brew-github-token"];
|
|
483
|
+
const ghEnv = token ? { env: { ...process.env, GH_TOKEN: token } } : {};
|
|
478
484
|
try {
|
|
479
485
|
execSync2("git push", { stdio: "inherit" });
|
|
480
486
|
} catch {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
487
|
+
try {
|
|
488
|
+
execSync2("git pull --rebase", { stdio: "inherit" });
|
|
489
|
+
execSync2("git push", { stdio: "inherit" });
|
|
490
|
+
} catch {
|
|
491
|
+
const branch = `pubm/brew-formula-v${releaseCtx.version}`;
|
|
492
|
+
execSync2(`git checkout -b ${branch}`, { stdio: "inherit" });
|
|
493
|
+
execSync2(`git push origin ${branch}`, { stdio: "inherit" });
|
|
494
|
+
try {
|
|
495
|
+
const prUrl = execSync2(`gh pr create --title "chore(brew): update formula to ${releaseCtx.version}" --body "Automated formula update by pubm"`, { encoding: "utf-8", ...ghEnv }).trim();
|
|
496
|
+
const prNumber = prUrl.match(/\/pull\/(\d+)/)?.[1];
|
|
497
|
+
if (prNumber) {
|
|
498
|
+
ctx.runtime.rollback.add({
|
|
499
|
+
label: `Close Homebrew tap PR #${prNumber}`,
|
|
500
|
+
fn: async () => {
|
|
501
|
+
execSync2(`gh pr close ${prNumber} --comment "Closed by pubm rollback"`, { stdio: "inherit", ...ghEnv });
|
|
502
|
+
},
|
|
503
|
+
confirm: true
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
console.log(`Created PR on branch ${branch}`);
|
|
507
|
+
} catch {
|
|
508
|
+
console.warn(`⚠ Failed to create PR. Push succeeded to branch: ${branch}`);
|
|
509
|
+
}
|
|
494
510
|
}
|
|
495
|
-
console.log(`Created PR on branch ${branch}`);
|
|
496
511
|
}
|
|
497
512
|
}
|
|
498
513
|
if (options.repo) {
|
|
@@ -526,26 +541,37 @@ function brewTap(options) {
|
|
|
526
541
|
try {
|
|
527
542
|
execSync2(`cd ${tmpDir} && git push`, { stdio: "inherit" });
|
|
528
543
|
} catch {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
});
|
|
533
|
-
execSync2(`cd ${tmpDir} && git push origin ${branch}`, {
|
|
534
|
-
stdio: "inherit"
|
|
535
|
-
});
|
|
536
|
-
const prUrl = execSync2(`gh pr create --repo ${ownerRepo} --title "chore(brew): update formula to ${releaseCtx.version}" --body "Automated formula update by pubm"`, { encoding: "utf-8", ...ghEnv }).trim();
|
|
537
|
-
const prNumber = prUrl.match(/\/pull\/(\d+)/)?.[1];
|
|
538
|
-
if (prNumber) {
|
|
539
|
-
const repoFlag = ownerRepo;
|
|
540
|
-
ctx.runtime.rollback.add({
|
|
541
|
-
label: `Close Homebrew tap PR #${prNumber} (${repoFlag})`,
|
|
542
|
-
fn: async () => {
|
|
543
|
-
execSync2(`gh pr close ${prNumber} --repo ${repoFlag} --comment "Closed by pubm rollback"`, { stdio: "inherit", ...ghEnv });
|
|
544
|
-
},
|
|
545
|
-
confirm: true
|
|
544
|
+
try {
|
|
545
|
+
execSync2(`cd ${tmpDir} && git pull --rebase`, {
|
|
546
|
+
stdio: "inherit"
|
|
546
547
|
});
|
|
548
|
+
execSync2(`cd ${tmpDir} && git push`, { stdio: "inherit" });
|
|
549
|
+
} catch {
|
|
550
|
+
const branch = `pubm/brew-formula-v${releaseCtx.version}`;
|
|
551
|
+
execSync2(`cd ${tmpDir} && git checkout -b ${branch}`, {
|
|
552
|
+
stdio: "inherit"
|
|
553
|
+
});
|
|
554
|
+
execSync2(`cd ${tmpDir} && git push origin ${branch}`, {
|
|
555
|
+
stdio: "inherit"
|
|
556
|
+
});
|
|
557
|
+
try {
|
|
558
|
+
const prUrl = execSync2(`gh pr create --repo ${ownerRepo} --title "chore(brew): update formula to ${releaseCtx.version}" --body "Automated formula update by pubm"`, { encoding: "utf-8", ...ghEnv }).trim();
|
|
559
|
+
const prNumber = prUrl.match(/\/pull\/(\d+)/)?.[1];
|
|
560
|
+
if (prNumber) {
|
|
561
|
+
const repoFlag = ownerRepo;
|
|
562
|
+
ctx.runtime.rollback.add({
|
|
563
|
+
label: `Close Homebrew tap PR #${prNumber} (${repoFlag})`,
|
|
564
|
+
fn: async () => {
|
|
565
|
+
execSync2(`gh pr close ${prNumber} --repo ${repoFlag} --comment "Closed by pubm rollback"`, { stdio: "inherit", ...ghEnv });
|
|
566
|
+
},
|
|
567
|
+
confirm: true
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
console.log(`Created PR on branch ${branch}`);
|
|
571
|
+
} catch {
|
|
572
|
+
console.warn(`⚠ Failed to create PR. Push succeeded to branch: ${branch}`);
|
|
573
|
+
}
|
|
547
574
|
}
|
|
548
|
-
console.log(`Created PR on branch ${branch}`);
|
|
549
575
|
}
|
|
550
576
|
}
|
|
551
577
|
}
|