Skip npm publish if already published
This helps make the publish workflow idempotent.
This commit is contained in:
parent
8608d8ec74
commit
3c0799fa59
@ -5,6 +5,14 @@ main() {
|
|||||||
cd "$(dirname "$0")/../.."
|
cd "$(dirname "$0")/../.."
|
||||||
source ./ci/lib.sh
|
source ./ci/lib.sh
|
||||||
|
|
||||||
|
# npm view won't exit with non-zero so we have to check the output.
|
||||||
|
local hasVersion
|
||||||
|
hasVersion=$(npm view "code-server@$VERSION" version)
|
||||||
|
if [[ $hasVersion == "$VERSION" ]]; then
|
||||||
|
echo "$VERSION is already published"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${CI-} ]]; then
|
if [[ ${CI-} ]]; then
|
||||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user