Skip to content

Commit da94936

Browse files
committed
Add retry logic in case recent changes on remote
1 parent e20d3e0 commit da94936

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

tools/scripts/npm_publish

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ update_package_meta_data() {
229229
# Updates package URLs in Markdown files.
230230
update_markdown_package_urls() {
231231
echo 'Updating package URLs in Markdown files...' >&2
232-
make markdown-pkg-urls
232+
make markdown-pkg-urls MARKDOWN_FILTER='.*/lib/node_modules/@stdlib/.*'
233233
if [[ "$?" -ne 0 ]]; then
234234
echo '' >&2
235235
echo 'Error: unexpected error. Encountered an error when updating package URLs in Markdown files.' >&2
@@ -400,10 +400,23 @@ update_remote_repository() {
400400
echo 'Pushing commits to remote repository...' >&2
401401
git push origin "${git_branch}"
402402
if [[ "$?" -ne 0 ]]; then
403-
echo '' >&2
404-
echo 'Error: unexpected error. Encountered an error when attempting to push commits to remote repository.' >&2
405-
echo '' >&2
406-
return 1
403+
echo 'Failed to push commits. Pulling down any recent changes...' >&2
404+
git pull origin "${git_branch}"
405+
if [[ "$?" -ne 0 ]]; then
406+
echo '' >&2
407+
echo 'Error: unexpected error. Pulling the latest changes failed. Check for merge conflicts.' >&2
408+
echo '' >&2
409+
return 1
410+
fi
411+
echo 'Successfully pulled latest changes.' >&2
412+
413+
git push origin "${git_branch}"
414+
if [[ "$?" -ne 0 ]]; then
415+
echo '' >&2
416+
echo 'Error: unexpected error. Encountered an error when attempting to push commits to remote repository.' >&2
417+
echo '' >&2
418+
return 1
419+
fi
407420
fi
408421
echo 'Successfully pushed commits.' >&2
409422
echo '' >&2

0 commit comments

Comments
 (0)