Skip to content

Commit 2c56b67

Browse files
dmartinochoaclaude
andcommitted
ci(publish): don't strand the GitHub release on a transient registry failure
Both registry publishes now use `continue-on-error: true` and the "Create GitHub release" step runs as long as at least one registry accepted the publish. A new "Registry publish status" step at the end re-asserts the job-level failure when either publish errored, so partial-success runs are still visible in the run UI / branch protection / notifications. Motivation: v1.0.2's publish workflow failed at "Publish to Open VSX" with an HTTP 405 (transient registry-side; v1.0.1 shipped unchanged 14 h earlier). Because the publish step is a `run:` script with `bash -e`, the job aborted there and "Create GitHub release" never ran — so v1.0.2 made it to the VS Code Marketplace but was missing from both Open VSX and GitHub Releases. The recovery cost a fresh 1.0.x tag (v1.0.3). Behaviour matrix after this change: vsce | ovsx | GH release | job -----|------|------------|----- ✓ | ✓ | created | green (unchanged) ✓ | ✗ | created | red (was: not created, red) ✗ | ✓ | created | red (was: not created, red) ✗ | ✗ | skipped | red (unchanged) The status step gates itself on `steps.<publish>.conclusion == 'success'` so it stays quiet when the job fails upstream of publish (lint, tests, audit, etc.) — `conclusion` is the post-`continue-on-error` roll-up, which is 'success' for any publish step that actually executed and 'skipped' for steps that never reached execution. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 21a5e26 commit 2c56b67

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,18 @@ jobs:
186186
with:
187187
subject-path: ${{ env.VSIX_PATH }}
188188

189+
# The two registry publishes use `continue-on-error: true` so a
190+
# transient failure in one registry doesn't strand the GitHub
191+
# release. v1.0.2 hit exactly this: Open VSX returned an HTTP 405
192+
# (registry-side hiccup) and `bash -e` aborted the job, which also
193+
# skipped the release step — leaving the .vsix on Marketplace but
194+
# no GitHub release for the tag. The final "Registry publish
195+
# status" step below still marks the job red if either publish
196+
# failed, so partial-success runs are visible in the run UI and
197+
# to any branch-protection/notification wiring.
189198
- name: Publish to VS Code Marketplace
199+
id: publish-vsce
200+
continue-on-error: true
190201
env:
191202
VSCE_PAT: ${{ secrets.VSCE_PAT }}
192203
run: |
@@ -195,6 +206,8 @@ jobs:
195206
--pat "$VSCE_PAT"
196207
197208
- name: Publish to Open VSX
209+
id: publish-ovsx
210+
continue-on-error: true
198211
env:
199212
OVSX_PAT: ${{ secrets.OVSX_PAT }}
200213
run: |
@@ -205,10 +218,47 @@ jobs:
205218
--pat "$OVSX_PAT"
206219
207220
- name: Create GitHub release
221+
# Run as long as at least one registry accepted the publish —
222+
# that's the case where consumers need somewhere to download
223+
# the .vsix from. If both registries failed, skip (no point
224+
# shipping a release tied to a version nobody can install) and
225+
# let the registry-status step below fail the job.
226+
if: |
227+
always() && !cancelled() &&
228+
(steps.publish-vsce.outcome == 'success' ||
229+
steps.publish-ovsx.outcome == 'success')
208230
env:
209231
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210232
run: |
211233
version=$(node -p "require('./package.json').version")
212234
gh release create "v${version}" "$VSIX_PATH" "$SBOM_PATH" $GH_PRERELEASE \
213235
--title "v${version}" \
214236
--notes-file <(awk '/^## \[/{n++} n==2{exit} n==1{print}' CHANGELOG.md)
237+
238+
- name: Registry publish status
239+
# continue-on-error on the publish steps lets the workflow
240+
# reach the GH release on partial success, but the job itself
241+
# must still fail if any registry rejected the publish so the
242+
# failure is visible in the run UI.
243+
#
244+
# Only run if at least one publish step actually executed — we
245+
# check `conclusion` (the post-continue-on-error roll-up, which
246+
# is 'success' for any step that ran, and 'skipped' for steps
247+
# that didn't reach execution). This keeps the status check
248+
# quiet on lint/test/audit failures upstream of publish.
249+
if: |
250+
always() && !cancelled() &&
251+
(steps.publish-vsce.conclusion == 'success' ||
252+
steps.publish-ovsx.conclusion == 'success')
253+
env:
254+
VSCE_OUTCOME: ${{ steps.publish-vsce.outcome }}
255+
OVSX_OUTCOME: ${{ steps.publish-ovsx.outcome }}
256+
run: |
257+
set -euo pipefail
258+
echo "VS Code Marketplace publish: $VSCE_OUTCOME"
259+
echo "Open VSX publish: $OVSX_OUTCOME"
260+
if [ "$VSCE_OUTCOME" != "success" ] || [ "$OVSX_OUTCOME" != "success" ]; then
261+
echo "::error::One or more registry publishes failed — see step logs above"
262+
exit 1
263+
fi
264+
echo "Both registries accepted the publish."

0 commit comments

Comments
 (0)