create-vuepress-site icon indicating copy to clipboard operation
create-vuepress-site copied to clipboard

Create publishing workflow

Open bencodezen opened this issue 5 years ago • 1 comments

Problem

Currently the process would be extremely manual.

  1. Bump version in package.json
  2. Update CHANGELOG
  3. Add tag
  4. Publish with npm publish

Proposal

We need a single command npm run publish that will take care of all of that in one go.

bencodezen avatar Aug 22 '20 13:08 bencodezen

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:

  1. Bump package.json by minor version e.g. from 1.2.3 to 1.3.0
  2. Make a commit with message 1.3.0
  3. 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
```

MichaelCurrin avatar Mar 28 '21 14:03 MichaelCurrin