create-vuepress-site
create-vuepress-site copied to clipboard
Create publishing workflow
Problem
Currently the process would be extremely manual.
- Bump version in
package.json - Update CHANGELOG
- Add tag
- Publish with
npm publish
Proposal
We need a single command npm run publish that will take care of all of that in one go.
You can use this command to handle the tagging. With argument as patch, minor, major or 4.5.6.
$ npm version minor
That do all the following in one move:
- Bump package.json by minor version e.g. from 1.2.3 to 1.3.0
- Make a commit with message 1.3.0
- Tag the commit as v1.3.0
Then tack on publish to that.
Sorry I don't know if there is a flow that handles changelog with a script.
{
"scripts": {
"release": "echo 'Update changelog...?' && npm version minor && npm publish"
}
}
I can't get the NPM command to pick up values dynamically neatly. But using a shell script is easy enough and is more readable.
-
bin/release(or "publish" if you prefer).#!/usr/bin/env bash set -e if [[ $? -ne 1 ]]; then echo 'Target version required' exit 1 fi echo "Update changelog" # ... echo "Tag new version" npm version $1 echo "Publish" npm publish
And then document development.md or suchlike.
# Publish
Guide for project maintainers.
When you are ready to package and publish a release, run this command in the shell (not supported on Windows, unless you use Linux Windows subsystem).
```sh
bin/release TARGET
```
e.g.
```sh
bin/release major
bin/release patch
bin/release 1.2.3
```