sync-version-numbers 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. # disable this script
  18. # until upload-to-cdn is refactored to publish multiple packages
  19. # remove when upload-to-cdn is back
  20. exit 0
  21. if [ "${ENDTOEND:=0}" = "1" ]; then
  22. echo "Publishing for e2e tests, skipping version number sync."
  23. exit 0
  24. fi
  25. commit_message="$(git log -1 --pretty=%B)"
  26. if [ "${commit_message}" != "Release" ]; then
  27. echo "Last commit is not a release commit, but '${commit_message}'"
  28. exit 1
  29. fi
  30. version_files="./examples/ README.md bin/upload-to-cdn.sh website/src/examples/ website/src/docs/ website/themes/uppy/layout/"
  31. main_package_version=$(node -p "require('./packages/uppy/package.json').version")
  32. # Legacy defeater for also renaming the old /dist/ locations, can be removed as soon as everything's on the new dist-less thing
  33. replace-x -r 'uppy/v\d+\.\d+\.\d+/dist/' "uppy/v$main_package_version/" ${version_files} --exclude=node_modules
  34. replace-x -r 'uppy/v\d+\.\d+\.\d+/' "uppy/v$main_package_version/" ${version_files} --exclude=node_modules
  35. # replace-x -r 'uppy@\d+\.\d+\.\d+' "uppy@$main_package_version" ${version_files} --exclude=node_modules
  36. git add ${version_files} # add changes to the Release commit