sync-version-numbers 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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. if [ "${ENDTOEND:=0}" = "1" ]; then
  18. echo "Publishing for e2e tests, skipping version number sync."
  19. exit 0
  20. fi
  21. commit_message="$(git log -1 --pretty=%B)"
  22. if [ "$commit_message" != "Release" ]; then
  23. echo "Last commit is not a release commit, but '$commit_message'"
  24. exit 1
  25. fi
  26. version_files="./examples/ README.md bin/upload-to-cdn.sh website/src/examples/ website/src/docs/ website/themes/uppy/layout/"
  27. main_package_version=$(node -p "require('./packages/uppy/package.json').version")
  28. replace-x -r 'uppy/v\d+\.\d+\.\d+/dist' "uppy/v$main_package_version/dist" $version_files --exclude=node_modules
  29. git add $version_files # add changes to the Release commit