Open moranje opened 5 years ago
Here's a link to a project I've used this on. Take a look at the commit messages and the changelog. The release is triggered by travis for any commit released on master.
Thanks for the example @moranje I was wondering how to integrate conventional commits and more automated releases in some of my projects and now I know I need to inspect the @semantic-release project workflows 👍
Hey, thanks for suggesting this! :) On consideration, I don't think semantic-release solves any problems that we have right now; sorry if I gave the wrong impression.
I do think setting up Prettier would be worthwhile, though; do you think the way I set it up for my project scratchblocks is reasonable? (We'd probably want a different .prettierrc
for Moo.)
No worries. It's here if you need it. I've had to look to master several times in my package.json because of unreleased features. It's not because of an impression you gave.
Your setup looks good. I would probably include, markdown files and possibly yml files. Using lint-staged would be a nice touch as well.
{
"scripts": {
"format": "prettier {,**/}*.{js,json,md,yml} --write"
},
"lint-staged": {
"package.json": [
"prettier-package-json --write",
"git add"
],
// I haven't checked this
"{,**/}*.{js,json,md,yml}": [
"prettier --write",
"git add"
]
}
}
Here's an optional automated release workflow other project I use have benefitted from. This does several things.
Commit hooks
This sets up several commit hooks to run checks on
pre-commit
andpre-push
.Enforce conventional commit messages
Spec
To use this
npm run commit
. This opens a prompt that guides you through the commit message. This is used later create semver released and an automated changelog.Automated releases
A
feat
will be either a major (if there are any breaking changes) or minor version bump. Afix
will lead to a patch version update. Anything else won't trigger a release. If set-up with tokens it will release to NPM and github. It will even release update the version in thepackage.json
and the commit the changed files to github. Also files will be formatted with prettier by default.Setup
First:
npm install -g semantic-release-cli
Then:
semantic-release-cli setup
Important! Answer NO to "Generate travis.yml" question