README
Simple release
Full auto pipeline for simple releases your packages.
- Collect git history for auto release
- Use Conventional Commits for commit guidelines
- Generate CHANGELOG.md
- Update package.json, package-lock.json
- Parse body commits as Markdown, support utf-8 and emoji 🚀
- Commit, tag and push new version
- Upload release on Github
- Upload package on Github
- Upload package on Npmjs.org
- Zero dependencies
Install
npm i @askuzminov/simple-release
CLI
package.json
"scripts": {
"release": "simple-release"
}
npm run release
Commands
help -> get command list
simple-release helpprerelease -> only up version, not git changes and release
simple-release prereleaseprerelease=SOME.NEW.VERSION -> only up version with custom ID
simple-release prerelease=1.2.0enable-prerelease -> force full process
simple-release enable-prereleasedisable-push -> prevent git push
simple-release disable-pushdisable-git -> prevent git commit and tag
simple-release disable-gitdisable-md -> prevent write CHANGELOG.md
simple-release disable-mddisable-github -> prevent github release
simple-release disable-githubpublish-github -> publish in github registry
simple-release publish-githubpublish-npmjs -> publish in npmjs registry
simple-release publish-npmjs--match -> Match only needed tags in git history
Using glob(7)
simple-release --match 'v[0-9]*' simple-release --match='v[0-9]*'--file -> Filter files for include/exclude
By default, all files are included except those described in
.gitignoreInclude:
- folder
- folder/file
- folder/*.css
Exclude:
- :!folder
- :!folder/*file
- :(exclude)folder
- :(exclude,icase)SUB
simple-release --file src --file types --file 'folder/*.css' --file ':!dist' simple-release --file=src --file=types --file='folder/*.css' --file=':!dist'--version -> Custom format for version, default
v{VERSION}simple-release --version v{VERSION} simple-release --version=v{VERSION} simple-release --version @my-org/my-lib@{VERSION}--source-repo -> Custom path to links for sourcecode
Default from
package.json:repository.urlsimple-release --source-repo myorg/somepackage simple-release --source-repo https://github.com/askuzminov/simple-release simple-release --source-repo https://github.com/askuzminov/simple-release.git--release-repo -> Custom path to links for release notes
Default from
package.json:repository.urlsimple-release --release-repo myorg/somepackage simple-release --release-repo https://github.com/askuzminov/simple-release simple-release --release-repo https://github.com/askuzminov/simple-release.git
Lint
Check commit message on:
"husky": {
"hooks": {
"commit-msg": "simple-release-lint"
}
},
Schemas of message:
<type>: <description>- simple variant<type>(scope): <description>- with some scope<type>!: <description>- breaking change<type>(scope)!: <description>- breaking change with scope
Example with body
feat(ABC-123): New solution
- Add [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- **Some** *specs* added...
Example with breaking change:
refactor(core): Migrate on new solution
BREAKING CHANGES: should upgrade version
Some specs...
Available types
- break -
MAJORBreaking changes - feat -
MINORFeatures - build -
PATCHBuild system or external dependencies - chore -
PATCHChore - ci -
PATCHContinuous Integration - docs -
PATCHDocumentation - fix -
PATCHBug Fixes - perf -
PATCHPerformance - refactor -
PATCHRefactoring - revert -
PATCHRevert code - style -
PATCHStyles and formatting - test -
PATCHTests
For MAJOR can be used ! (example refactor!: new lib).
For MAJOR also can be used BREAKING CHANGES: or BREAKING CHANGE: in description of commit.
Ignored commits in lint
- Merge pull request
- Merge remote-tracking branch
- Automatic merge
- Auto-merged ... in ...
- Auto-merged ... into ...
- Merged ... in ...
- Merged ... into ...
- Merge branch
- Revert
- revert
- fixup
- squash
Scripts
Used standard scripts for https://docs.npmjs.com/cli/version.
"scripts": {
"preversion": "npm test",
"version": "npm run build",
"postversion": "npm run clean"
}
And when enable publish, used standard scripts for https://docs.npmjs.com/cli/publish.
See full list of scripts in https://docs.npmjs.com/misc/scripts#description.
Example CI
echo "Setup NPM"
echo 'always-auth=true' > ~/.npmrc
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc
echo '//npm.pkg.github.com/:_authToken=${GH_TOKEN}' >> ~/.npmrc
if [[ $BRANCH_NAME == 'master' ]]; then
echo "Release production"
npx @askuzminov/simple-release publish-github publish-npmjs
else
echo "Release canary"
npx @askuzminov/simple-release publish-github publish-npmjs prerelease=$BRANCH_NAME.$BUILD_ID
fi
Github actions
Use fetch-depth for full
- name: Checkout
uses: actions/checkout@v2
with: { fetch-depth: 0 }
Setup GIT example
Setup branch for push
git config --global push.default current
git config --local user.email "bot@ci.com"
git config --local user.name "CI"
mkdir -p ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts