sync-version-numbers 1.2 KB

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. # Called by the `version` npm script.
  3. # This is run _after_ lerna updates the version numbers,
  4. # but _before_ it commits, so we have time to update the
  5. # version numbers throughout the repo and add it to the
  6. # release commit.
  7. # NOTE this _amends_ the previous commit, which should
  8. # already be a "Release" commit generated by bin/release.
  9. set -o pipefail
  10. set -o errexit
  11. set -o nounset
  12. # Set magic variables for current file & dir
  13. __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  14. __file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
  15. __base="$(basename ${__file} .sh)"
  16. __root="$(cd "$(dirname "${__dir}")" && pwd)"
  17. commit_message="$(git log -1 --pretty=%B)"
  18. if [ "$commit_message" != "Release" ]; then
  19. echo "Last commit is not a release commit, but '$commit_message'"
  20. exit 1
  21. fi
  22. version_files="./examples/ README.md bin/upload-to-cdn.sh website/src/examples/ website/src/docs/ website/themes/uppy/layout/"
  23. main_package_version=$(node -p "require('./packages/uppy/package.json').version")
  24. replace-x -r 'uppy/v\d+\.\d+\.\d+/dist' "uppy/v$main_package_version/dist" $version_files --exclude=node_modules
  25. git commit --amend --no-edit $version_files # add changes to the Release commit