Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Create publishing workflow #2

Open
bencodezen opened this issue Aug 22, 2020 · 1 comment
Open

Create publishing workflow #2

bencodezen opened this issue Aug 22, 2020 · 1 comment

Comments

@bencodezen
Copy link
Contributor

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.

@MichaelCurrin
Copy link

MichaelCurrin commented Mar 28, 2021

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
```

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants