Skip to content

Commit 3c0799f

Browse files
committed
Skip npm publish if already published
This helps make the publish workflow idempotent.
1 parent 8608d8e commit 3c0799f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ci/steps/publish-npm.sh

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ main() {
55
cd "$(dirname "$0")/../.."
66
source ./ci/lib.sh
77

8+
# npm view won't exit with non-zero so we have to check the output.
9+
local hasVersion
10+
hasVersion=$(npm view "code-server@$VERSION" version)
11+
if [[ $hasVersion == "$VERSION" ]]; then
12+
echo "$VERSION is already published"
13+
return
14+
fi
15+
816
if [[ ${CI-} ]]; then
917
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
1018
fi

0 commit comments

Comments
 (0)