Skip to content

Commit 600704d

Browse files
Brooooooklynfengmk2
authored andcommitted
ci: allow retry the failed native package publishing
1 parent 686e778 commit 600704d

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

packages/cli/publish-native-addons.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,24 @@ const platformDirs = await readdir(npmDir);
5757
// Publish each NAPI platform package (without vp binary)
5858
const npmTag = process.env.NPM_TAG || 'latest';
5959
for (const file of platformDirs) {
60-
execSync(`npm publish --tag ${npmTag} --access public`, {
61-
cwd: join(currentDir, 'npm', file),
62-
env: process.env,
63-
stdio: 'inherit',
64-
});
60+
try {
61+
const output = execSync(`npm publish --tag ${npmTag} --access public`, {
62+
cwd: join(currentDir, 'npm', file),
63+
env: process.env,
64+
stdio: 'pipe',
65+
});
66+
process.stdout.write(output);
67+
} catch (e) {
68+
if (
69+
e instanceof Error &&
70+
e.message.includes('You cannot publish over the previously published versions')
71+
) {
72+
console.info(e.message);
73+
console.warn(`${file} has been published, skipping`);
74+
} else {
75+
throw e;
76+
}
77+
}
6578
}
6679

6780
// Platform metadata for CLI packages

0 commit comments

Comments
 (0)