2.0.0-beta.48 • Published 4 years ago

@getyourguide/npm-publish v2.0.0-beta.48

Weekly downloads
14
License
Apache-2.0
Repository
github
Last release
4 years ago

GetYourGuide - npm publish

CLI tool to handle publishing modules, detecting the version increment from the commit message, generating the tags and pushing to github.

Features

  • Allow to define increment (patch, minor, major) based on commit message.
  • Allow to create beta versions based on the message.
  • Increase automatically version in package.json creating a tag and pushing to your repo.
  • Define branchs in which you want to publish and which ones to omit it.

Workflow

  • Push commits to a publish branch [default: master] using any of the wildcards as part of your message [minor] ... [major] ... and the library will generate a version for you. If it doesn't detect any wildcard, it will do a patch.
  • Pushing commits to no-publish branches will omit the version generation.
  • If you're in any branch and you would like to generate a beta version, just commit with [beta] ...

Getting Started

npm install --save-dev @getyourguide/npm-publish

Usage with Drone or Github Actions

  1. Create a npm script in your package.json
{
  "scripts": {
    "npm-publish": "npm-publish"
  }
}
  1. Add a step to publish your module

Drone

publish-package:
  image: node:12-buster
  commands:
    - npm run npm-publish -- -b ${DRONE_BRANCH} -m "$${DRONE_COMMIT_MESSAGE}"

Github Actions

- name: Publish library
  run: npm run npm-publish -- -b "${{ github.ref }}" -m "${{ github.event.head_commit.message }}"

workflow.yml full example

CLI Params

Run with --help to get a full list of params

npm-publish --help

Options:                                   
  --help                                                    
  --branch, -b           branch name                                         [required]
  --message, -m          commit message                                      [required]
  --publish-branches     branches where it should publish   [array] [default: "master"]
  --wildcard-minor       wildcard to identify a minor commit       [default: "[minor]"]
  --wildcard-major       wildcard to identify a major commit       [default: "[major]"]
  --wildcard-beta        wildcard to identify a beta commit         [default: "[beta]"]
  --wildcard-no-publish  wildcard to identify a nopublish commit    [default: "[beta]"]
  --git-email            git email to create the comit.   [default: "local git config"]
  --git-name             git name to create the commit.   [default: "local git config"]
  --registry             force npm registry to publish.   [default: ignore]
  --commit-message       commit message. Use %v to specify the version and %p for package
                                       [default: "[npm-publish] %p@%v [ci skip]"]
  --tag-name             git tag name. Use %v to specify the version and %p for package
                                       [default: "v%v"]

Add config in package.json

You can also specify the params in your package.json. Add a section npm-publish

{
  "npm-publish": {
    "publishBranches": ["master", "develop"],
    "wildcardMinor": "[custom-minor]",
    "wildcardMajor": "[custom-major]",
    "gitEmail": "it@mycompany.com",
    "gitName": "IT - MyCompany",
    "...": "..."
  }
}
2.0.26

4 years ago

2.0.27

4 years ago

2.0.25

4 years ago

2.0.24

4 years ago

2.0.9-beta1

4 years ago

2.0.3

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.22-beta.73

4 years ago

2.0.0-beta3

4 years ago

2.0.0-beta1

4 years ago

2.0.0-beta2

4 years ago

2.0.24-beta.43

4 years ago

2.0.0-beta.54

4 years ago

2.0.22-beta.38

4 years ago

2.0.12-beta.2

4 years ago

1.0.15-beta.1

4 years ago

1.0.15-beta.0

4 years ago

2.0.15

4 years ago

2.0.16

4 years ago

2.0.13

4 years ago

2.0.14

4 years ago

2.0.11

4 years ago

2.0.12

4 years ago

2.0.10

4 years ago

2.0.0-beta.48

4 years ago

2.0.22-beta.50

4 years ago

2.0.1-beta.13

4 years ago

2.0.19

4 years ago

2.0.17

4 years ago

2.0.18

4 years ago

2.0.22

4 years ago

2.0.23

4 years ago

2.0.20

4 years ago

2.0.21

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago