Skip to content

Commit da1488c

Browse files
authored
if publish fails, try again in 60s
if two publishes happen simultaneously (such as default branch and tag branch) then one will fail
1 parent 05379ad commit da1488c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: action.bash

+10-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ if test -n "${REPO_TAG-}" -o -n "${tag-}"; then
9191
next="${version%-*}-${tag}.${time}.${REPO_SHA}" # version trims anything after -
9292
npm version "${next}" --git-tag-version=false
9393
echo "publishing branch ${branch} to tag ${tag} with version ${next}..."
94-
npm publish --access public --tag "${tag}"
94+
npm publish --access public --tag "${tag}" || {
95+
echo "trying again in 60s..."
96+
sleep 60
97+
npm publish --access public --tag "${tag}"
98+
}
9599

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

130134
echo "publishing to tag ${tag} with version ${cdn}..."
131-
npm publish --access public --tag "${tag}"
135+
npm publish --access public --tag "${tag}" || {
136+
echo "trying again in 60s..."
137+
sleep 60
138+
npm publish --access public --tag "${tag}"
139+
}
132140

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

0 commit comments

Comments
 (0)