Skip to content

Commit 6a6498a

Browse files
Peter Stengerclaude
andcommitted
ci: fail release on real extension publish errors
The `|| echo "Version may already exist, skipping"` fallback masked genuine vsce/ovsx failures (reserved name, reserved displayName, auth), leaving the workflow green while nothing published. Replace it with a version pre-check: skip publishing only when that exact version is already on the registry (vsce show / Open VSX API), and let any other failure fail the job. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a6f618c commit 6a6498a

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ jobs:
8686
- name: Publish to VS Code Marketplace
8787
if: github.event_name == 'release'
8888
working-directory: lsp
89-
run: vsce publish --packagePath htmlmustache-lsp.vsix || echo "Version may already exist, skipping"
89+
# Skip only if this exact version is already published; let any other
90+
# vsce failure (e.g. reserved name/displayName, auth) fail the job.
91+
run: |
92+
read -r EXT VERSION < <(node -p "const p=require('./package.json'); p.publisher+'.'+p.name+' '+p.version")
93+
if vsce show "$EXT" --json 2>/dev/null | node -e "const v=require('fs').readFileSync(0,'utf8'); let j; try{j=JSON.parse(v)}catch{process.exit(1)} process.exit((j.versions||[]).some(x=>x.version===process.argv[1])?0:1)" "$VERSION"; then
94+
echo "::notice::$EXT@$VERSION already on VS Marketplace, skipping publish"
95+
else
96+
vsce publish --packagePath htmlmustache-lsp.vsix
97+
fi
9098
env:
9199
VSCE_PAT: ${{ secrets.VSCE_PAT }}
92100

@@ -96,6 +104,15 @@ jobs:
96104
- name: Publish to Open VSX Registry
97105
if: github.event_name == 'release'
98106
working-directory: lsp
99-
run: ovsx publish htmlmustache-lsp.vsix || echo "Version may already exist, skipping"
107+
# Skip only if this exact version is already published (API returns 200);
108+
# let any other ovsx failure (e.g. auth, namespace) fail the job.
109+
run: |
110+
read -r NS NAME VERSION < <(node -p "const p=require('./package.json'); p.publisher+' '+p.name+' '+p.version")
111+
code=$(curl -s -o /dev/null -w '%{http_code}' "https://open-vsx.org/api/$NS/$NAME/$VERSION")
112+
if [ "$code" = "200" ]; then
113+
echo "::notice::$NS.$NAME@$VERSION already on Open VSX, skipping publish"
114+
else
115+
ovsx publish htmlmustache-lsp.vsix
116+
fi
100117
env:
101118
OVSX_PAT: ${{ secrets.OVSX_PAT }}

0 commit comments

Comments
 (0)