-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(build): Add release script for maintenance #2208
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env bash | ||
|
||
[ -z $HOTFIX ] && HOTFIX='0' | ||
|
||
set -e # exit when error | ||
|
||
if [[ -n $(npm owner add `npm whoami`) ]]; then | ||
printf "Release: Not an owner of the npm repo, ask for it\n" | ||
exit 1 | ||
fi | ||
|
||
currentBranch=`git rev-parse --abbrev-ref HEAD` | ||
if [ $currentBranch != 'maintenance' ]; then | ||
printf "Release: You must be on maintenance\n" | ||
exit 1 | ||
fi | ||
|
||
if [[ -n $(git status --porcelain) ]]; then | ||
printf "Release: Working tree is not clean (git status)\n" | ||
exit 1 | ||
fi | ||
|
||
printf "Release: install dependencies" | ||
yarn | ||
|
||
currentVersion=`cat package.json | json version` | ||
|
||
# header | ||
printf "\n\nRelease: current version is $currentVersion" | ||
printf "\nRelease: a changelog will be generated only if a fix/feat/performance/breaking token is found in git log" | ||
printf "\nRelease: you must choose a new ve.rs.ion (semver)" | ||
printf "\nRelease: press q to exit the next screen\n\n" | ||
|
||
# preview changelog | ||
read -p "=> Release: press [ENTER] to view changes since latest version.." | ||
|
||
conventional-changelog --preset angular --output-unreleased | less | ||
|
||
# choose and bump new version | ||
# printf "\n\nRelease: Please enter the new chosen version > " | ||
printf "\n=> Release: please type the new chosen version > " | ||
read -e newVersion | ||
VERSION=$newVersion babel-node ./scripts/bump-package-version.js | ||
|
||
# build new version | ||
NODE_ENV=production VERSION=$newVersion npm run build | ||
|
||
# update changelog | ||
printf "\n\nRelease: update changelog" | ||
changelog=`conventional-changelog -p angular` | ||
conventional-changelog --preset angular --infile CHANGELOG.md --same-file | ||
|
||
# regenerate readme TOC | ||
printf "\n\nRelease: generate TOCS" | ||
npm run doctoc | ||
|
||
# regenerate widgets jsdoc | ||
printf "\n\nRelease: regenerate widgets jsdoc" | ||
npm run docs:jsdoc | ||
|
||
# regenerate yarn.lock | ||
printf "Release: update yarn.lock" | ||
yarn | ||
|
||
# git add and tag | ||
commitMessage="v$newVersion\n\n$changelog" | ||
git add src/lib/version.js yarn.lock package.json CHANGELOG.md README.md CONTRIBUTING.md docs/_includes/widget-jsdoc | ||
printf "$commitMessage" | git commit --file - | ||
git tag "v$newVersion" | ||
|
||
printf "\n\nRelease: almost done, check everything in another terminal tab.\n" | ||
read -p "=> Release: when ready, press [ENTER] to push to github and publish the package" | ||
|
||
printf "\n\nRelease: push to github, publish on npm" | ||
git push origin maintenance | ||
git push origin --tags | ||
npm publish | ||
|
||
printf "Release: | ||
Package was published to npm. | ||
A job on travis-ci will be automatically launched to finalize the release." |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
run
can be left outThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it works too ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the party: I never managed to run a scrip with yarn that will use "npm publish" at some point. I got credentials not being read for publishing to npm. I believe this is still an issue (and that's why previous command was npm run release).
To me that's one of yarn drawbacks that could make us switch back to npm (because if we need to use both yarn and npm, it's a struggle)