build: add release script

Making sure the changelog is included in tags. Also unifies the tag bump with
the changelog generation.
pull/83/head
Eduardo San Martin Morote 4 years ago
parent 11060136c4
commit 867a113420

@ -32,10 +32,9 @@
"dev-client-copy": "node scripts/watchAndCopy",
"dev-node": "tsc -w -p src/node",
"dev-shared": "tsc -w -p src/shared",
"release": "bash scripts/release.sh",
"build": "rimraf -rf dist && tsc -p src/client && tsc -p src/node && tsc -p src/shared && node scripts/copy",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"prepublishOnly": "yarn build && yarn changelog",
"postpublish": "git add CHANGELOG.md && git commit -m 'chore: changelog [ci skip]'"
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
"engines": {
"node": ">=10.0.0"

@ -0,0 +1,34 @@
set -e
echo "Current version:" $(grep version package.json | sed -E 's/^.*"([0-9][^"]+)".*$/\1/')
echo "Enter the new version you want to publish e.g., 0.0.2: "
read VERSION
read -p "Releasing v$VERSION - are you sure? (y/n)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Releasing v$VERSION ..."
# generate the version so that the changelog can be generated too
yarn version --no-git-tag-version --no-commit-hooks --new-version $VERSION
yarn run build
# changelog
yarn run changelog
yarn prettier --write CHANGELOG.md
echo "Please check the git history and the changelog and press enter"
read OKAY
# commit and tag
git add CHANGELOG.md package.json
git commit -m "release: v$VERSION"
git tag "v$VERSION"
# commit
yarn publish --new-version "$VERSION" --no-commit-hooks --no-git-tag-version
# publish
git push origin refs/tags/v$VERSION
git push
fi
Loading…
Cancel
Save