devops: always check git status before publishing to npm (#5070)

This commit is contained in:
Dmitry Gozman 2021-01-20 13:08:51 -08:00 committed by GitHub
parent f10f170946
commit a7949173e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,11 +44,12 @@ cd ..
NPM_PUBLISH_TAG="next"
VERSION=$(node -e 'console.log(require("./package.json").version)')
if [[ -n $(git status -s) ]]; then
echo "ERROR: git status is dirty; some uncommitted changes or untracked files"
exit 1
fi
if [[ $1 == "--release" ]]; then
if [[ -n $(git status -s) ]]; then
echo "ERROR: git status is dirty; some uncommitted changes or untracked files"
exit 1
fi
# Ensure package version does not contain dash.
if [[ "${VERSION}" == *-* ]]; then
echo "ERROR: cannot publish pre-release version with --release flag"