pascalgn / npm-publish-action

GitHub action to automatically publish packages to npm
MIT License
221 stars 29 forks source link

Accept default commit messages from `npm version` and `yarn version` #6

Open mohsen1 opened 4 years ago

mohsen1 commented 4 years ago

I use the default worflow of yarn for making a new release: yarn version --new-version patch

This makes a commit with message like v0.0.1

Currently I have to update the commit message to say Release v0.0.1 or change the configuration of this action.

Although very minor, it would be nice for that to simply work.

pascalgn commented 4 years ago

I think that would make sense, yes. Do you want to provide a PR? 😇

rzr commented 4 years ago

But "npm version patch" commits without the v prefix like "0.0.1"

Wakeful-Cloud commented 4 years ago

I think the below expression may be helpful:

^v?(\d+\.\d+\.\d+(?:-(?:alpha|beta)\.\d+)?)$

Features:

Before After
v1.2.3 1.2.3
1.2.3 1.2.3
v11.12.13 11.12.13
11.12.13 11.12.13
11.12.13-alpha.10 11.12.13-alpha.10
v1.2.3-alpha.0 1.2.3-alpha.0
1.2.3-alpha.0 1.2.3-alpha.0
v1.2.3-beta.0 1.2.3-beta.0

Non matches: x1.2.3, x1.2.3-gamma, x11.12.13, v1.2.3-alpha

You can find *unit* tests for it at https://regexr.com/589ii

@pascalgn Do you want me to make a PR for this Regex? If yes, do you want me to add unit tests with mocha/chai?

pascalgn commented 4 years ago

Yes, feel free to create a PR! Adding a unit test should be fine, too!