release.sh 581 B

1234567891011121314151617181920212223242526272829
  1. set -e
  2. read -p "Enter release version: " VERSION
  3. read -p "Enter release tag (latest): " TAG
  4. TAG=${TAG:-latest}
  5. read -p "Releasing $VERSION for the tag '$TAG' - are you sure? (y/n)" -n 1 -r
  6. echo # (optional) move to a new line
  7. if [[ $REPLY =~ ^[Yy]$ ]]
  8. then
  9. echo "Releasing $VERSION ..."
  10. # run tests
  11. npm test 2>/dev/null
  12. # build
  13. VERSION=$VERSION npm run build
  14. # commit
  15. git add -A
  16. git commit -m "[build] $VERSION"
  17. npm version $VERSION --message "[release] $VERSION"
  18. # publish
  19. git push origin refs/tags/v$VERSION
  20. git push
  21. npm publish --tag $TAG
  22. fi