Skip to content

Commit

Permalink
if publish fails, try again in 60s
Browse files Browse the repository at this point in the history
if two publishes happen simultaneously (such as default branch and tag branch) then one will fail
  • Loading branch information
balupton authored Nov 18, 2023
1 parent 05379ad commit da1488c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions action.bash
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ if test -n "${REPO_TAG-}" -o -n "${tag-}"; then
next="${version%-*}-${tag}.${time}.${REPO_SHA}" # version trims anything after -
npm version "${next}" --git-tag-version=false
echo "publishing branch ${branch} to tag ${tag} with version ${next}..."
npm publish --access public --tag "${tag}"
npm publish --access public --tag "${tag}" || {
echo "trying again in 60s..."
sleep 60
npm publish --access public --tag "${tag}"
}

# publish package.json
else
Expand Down Expand Up @@ -128,7 +132,11 @@ if test -n "${BEVRY_CDN_TOKEN-}"; then
npm version "${cdn}" --git-tag-version=false

echo "publishing to tag ${tag} with version ${cdn}..."
npm publish --access public --tag "${tag}"
npm publish --access public --tag "${tag}" || {
echo "trying again in 60s..."
sleep 60
npm publish --access public --tag "${tag}"
}

echo "adding cdn aliases..."
packageName="$(node -e "process.stdout.write(require('./package.json').name)")"
Expand Down

0 comments on commit da1488c

Please sign in to comment.