fix(publish): use batch publishing to prevent OIDC token expiration

This commit is contained in:
justsisyphus 2026-01-19 15:10:47 +09:00
parent 380b946681
commit f10734c545

View File

@ -192,10 +192,22 @@ async function publishAllPackages(version: string): Promise<void> {
if (skipPlatform) { if (skipPlatform) {
console.log("\n⏭ Skipping platform packages (SKIP_PLATFORM_PACKAGES=true)") console.log("\n⏭ Skipping platform packages (SKIP_PLATFORM_PACKAGES=true)")
} else { } else {
console.log("\n📦 Publishing platform packages in parallel...") console.log("\n📦 Publishing platform packages in batches (to avoid OIDC token expiration)...")
// Publish platform packages in parallel for speed (avoids OIDC token expiration) // Publish in batches of 2 to avoid OIDC token expiration
const publishPromises = PLATFORM_PACKAGES.map(async (platform) => { // npm processes requests sequentially even when sent in parallel,
// so too many parallel requests can cause token expiration
const BATCH_SIZE = 2
const failures: string[] = []
for (let i = 0; i < PLATFORM_PACKAGES.length; i += BATCH_SIZE) {
const batch = PLATFORM_PACKAGES.slice(i, i + BATCH_SIZE)
const batchNum = Math.floor(i / BATCH_SIZE) + 1
const totalBatches = Math.ceil(PLATFORM_PACKAGES.length / BATCH_SIZE)
console.log(`\n Batch ${batchNum}/${totalBatches}: ${batch.join(", ")}`)
const publishPromises = batch.map(async (platform) => {
const pkgDir = join(process.cwd(), "packages", platform) const pkgDir = join(process.cwd(), "packages", platform)
const pkgName = `oh-my-opencode-${platform}` const pkgName = `oh-my-opencode-${platform}`
@ -207,7 +219,6 @@ async function publishAllPackages(version: string): Promise<void> {
const results = await Promise.all(publishPromises) const results = await Promise.all(publishPromises)
const failures: string[] = []
for (const { pkgName, result } of results) { for (const { pkgName, result } of results) {
if (result.success) { if (result.success) {
if (result.alreadyPublished) { if (result.alreadyPublished) {
@ -220,6 +231,7 @@ async function publishAllPackages(version: string): Promise<void> {
failures.push(pkgName) failures.push(pkgName)
} }
} }
}
if (failures.length > 0) { if (failures.length > 0) {
throw new Error(`Failed to publish: ${failures.join(", ")}`) throw new Error(`Failed to publish: ${failures.join(", ")}`)