uppy/bin/release
Antoine du Hamel 01d7ea13e9
meta: use Yarn v3 instead of npm (#3237)
* meta: use Yarn v3 instead of npm

* Update CONTRIBUTING.md to fix linter errors

* remove remaining npm commands

* Update deps
2021-10-20 15:16:59 +02:00

72 lines
1.9 KiB
Bash
Executable file

#!/usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
__root="$(cd "$(dirname "${__dir}")" && pwd)"
is_local="${LOCAL:-0}"
echo "Local release: $is_local"
CHANGED=$(git diff-index --name-only HEAD --)
if [ -n "$CHANGED" ]; then
echo "Found local, uncomitted git changes"
echo ""
echo "Please ensure that your working tree is clean"
exit 1
fi
if [[ ! "$@" =~ -y ]]; then
echo "Make sure to read https://uppy.io/docs/contributing#Releases!"
echo "Press Enter when ready, or Ctrl+C if you still need to do something."
echo "Use 'yarn run release -- -y' to bypass this message."
read
fi
if [ $is_local == "0" ] && [[ ! "$(yarn config get registry)" =~ https://registry\.npmjs\.(com|org)/? ]]; then
echo "Found unexpected npm registry: $(yarn config get registry)"
echo "Run this to fix:"
echo ""
echo "yarn config set registry https://registry.npmjs.org"
exit 1
fi
if ! yarn whoami > /dev/null; then
echo "Not authenticated with yarn. First do:"
echo ""
echo "yarn login"
exit 1
fi
set -o xtrace
# Update README before publishing `uppy`
# So up-to-date contributors are shown on the npm page.
yarn run contributors:save
git add README.md
# Add readme file to the main `uppy` package.
cp README.md packages/uppy/README.md
yarn run build:clean
FRESH=1 yarn run build
echo "!! The next step is the actual release!"
echo "!! If something goes wrong after here, it becomes hard to reverse. Please make sure that everything is in order."
echo "Press Enter when ready, or Ctrl+C if you still need to do something."
read
git commit --allow-empty -m "Release"
lerna version --amend --no-push --exact
lerna publish from-git
if [ $is_local == "0" ]; then
git push
git push --tags
fi