diff --git a/package.json b/package.json index 6d05950..088e8c2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "docs:prepare": "cd docs/_book && git init && git checkout -b gh-pages && git add . && git commit -m 'Update documentation'", "docs:publish": "cd docs/_book && git push git@github.com:uphold/uphold-sdk-javascript gh-pages --force && cd .. && rm -rf _book", "lint": "eslint --cache src test", - "release": "npm version $1 -m 'Release %s'", + "release": "tasks/release.sh", "tdd": "yarn test --watch", "test": "jest --config jest.json", "version": "yarn build && yarn changelog && git add -f dist CHANGELOG.md" diff --git a/tasks/release.sh b/tasks/release.sh new file mode 100755 index 0000000..493bc3c --- /dev/null +++ b/tasks/release.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +release() { + # Clean node_modules + rm -rf node_modules && rm -f yarn.lock + + # Install dependencies. + yarn + + # Bump version. + yarn version --no-git-tag-version --new-version ${1:-patch} + + # Get the new version number. + local version=`grep -m1 version package.json | cut -d '"' -f4` + + # Create deploy branch. + git checkout -b deploy/${version} + + # Generate changelog. + github-changelog-generator --owner=uphold --repo=uphold-sdk-javascript --future-release=${version} > CHANGELOG.md + + # Build release + yarn build + + # Add modified files. + git add -f dist yarn.lock package.json CHANGELOG.md + + # Commit release with new version. + git commit -m "Release ${version}" +} + +release $1