feat: Add semantic versioning compatibility (#47)

* feat: Use regex groups

* feat: Add semver input

* deps: Add semver v7.3.7

* deps(Dev): Add @types/semver v7.3.9

* feat: Add prerelease output

* chore: Update action directory

* feat: Log prerelease value

* ci(GitHub): Update release workflow

* docs: Update README.md

* feat: Add ability to detect previous version based on semver comparison

* ci(GitHub): fix test workflow
This commit is contained in:
Ardalan Amini authored and GitHub committed 2022-04-29 00:06:26 +04:30
1 parent de993f2bea
commit bd78d66436
16 files changed
+226 -53

No files matched your search

+29
View File
@@ -11,8 +11,10 @@ Automatic Changelog generator
- [Github Token](#github-token)
- [Commit Types](#commit-types)
- [Default Commit Type](#default-commit-type)
- [SemVer Compatibility](#semver)
- [Outputs](#outputs)
- [Changelog](#changelog)
- [Pre-release](#prerelease)
- [Example Usage](#example-usage)
## Usage
@@ -92,12 +94,38 @@ _Default:_
Other Changes
```
#### `semver`
**(Optional)**
Enable semver based version comparison.
If enabled it'll determine whether the github ref is a valid semver string,
it'll fail the action in case it's not.
It'll then determine whether the version is a pre-release or not,
if it is, the previous version will be selected from any version (pre-release or not) lesser than the current ref,
if current ref is not a pre-release,
the previous version will be selected only from the latest version (not pre-release) lesser than the current ref.
_Default:_
```yaml
true
```
### Outputs
#### `changelog`
The generated changelog.
#### `prerelease`
Indicates whether it's a pre-release or not.
> if semver is set to `true`, otherwise this output will always return `false`.
### Example Usage
Using with default inputs:
@@ -132,4 +160,5 @@ Using with custom inputs:
chore: Chores
other: Other Changes
default-commit-type: Other Changes
semver: true
```