Skip to content

Commit 4383c78

Browse files
committed
fix(ci): handle "already exists" in vscode publish gracefully
Add hack/publish-vscode.sh wrapper that catches "already exists" errors from vsce and exits 0, preventing false CI failures from marketplace race conditions. Update publish:vscode script to use it. Assisted-by: Claude
1 parent 229fa2e commit 4383c78

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

hack/publish-vscode.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Publish the VSCode extension to the marketplace. If the version already exists,
4+
# exit 0 instead of failing the CI run.
5+
#
6+
7+
set -euo pipefail
8+
9+
(
10+
cd packages/vscode
11+
12+
if output=$(pnpm exec vsce publish --packagePath obsidian-vfs.vsix 2>&1); then
13+
exit 0
14+
fi
15+
16+
if [[ "${output}" == *"already exists"* ]]; then
17+
echo "Version already published, skipping." >&2
18+
exit 0
19+
fi
20+
21+
echo "${output}" >&2
22+
exit 1
23+
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"publish:npm": "pnpm publish:npm:core && pnpm publish:npm:cli",
2727
"publish:npm:core": "hack/publish-npm.sh packages/core",
2828
"publish:npm:cli": "hack/publish-npm.sh packages/cli",
29-
"publish:vscode": "pnpm --filter obsidian-vfs run publish",
29+
"publish:vscode": "hack/publish-vscode.sh",
3030
"reset": "pnpm -r run clean && rm -rf node_modules packages/*/node_modules && pnpm install"
3131
},
3232
"pnpm": {

0 commit comments

Comments
 (0)