File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,11 +300,34 @@ jobs:
300300 run : npm pack --dry-run
301301
302302 - name : Publish package
303+ id : publish_package
303304 working-directory : bindings/javascript
305+ continue-on-error : true
304306 env :
305307 NPM_CONFIG_PROVENANCE : true
308+ NPM_CONFIG_LOGLEVEL : verbose
309+ shell : bash
306310 run : |
307- npm publish --access public --provenance
311+ set -o pipefail
312+ npm publish --access public --provenance 2>&1 | tee "$RUNNER_TEMP/npm-publish.log"
313+
314+ - name : Surface publish failure
315+ if : steps.publish_package.outcome != 'success'
316+ shell : bash
317+ run : |
318+ LOG_FILE="$RUNNER_TEMP/npm-publish.log"
319+ if [ -f "$LOG_FILE" ]; then
320+ tail -n 200 "$LOG_FILE"
321+ mapfile -t lines < <(grep -E 'npm error|npm warn|ERR!|E[0-9A-Z]+|404|auth|trusted|provenance|repository' "$LOG_FILE" | tail -n 20 || true)
322+ if [ "${#lines[@]}" -eq 0 ]; then
323+ mapfile -t lines < <(tail -n 20 "$LOG_FILE")
324+ fi
325+ for line in "${lines[@]}"; do
326+ clean_line="${line//$'\r'/}"
327+ echo "::error title=npm publish::${clean_line}"
328+ done
329+ fi
330+ exit 1
308331
309332 skip :
310333 needs : preflight
You can’t perform that action at this time.
0 commit comments