mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 04:58:17 +00:00
Compare commits
13 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1025b26f2 | ||
|
|
6b919cc3ae | ||
|
|
7b71828c01 | ||
|
|
bdf7908364 | ||
|
|
305899e7da | ||
|
|
c4f3793c16 | ||
|
|
7adc5c502c | ||
|
|
c423ebb784 | ||
|
|
a8f8f59fd7 | ||
|
|
8c0b779a80 | ||
|
|
4df56d00ce | ||
|
|
e528d273e7 | ||
|
|
23baf5d553 |
11 changed files with 592 additions and 183 deletions
281
CHANGELOG.md
Normal file
281
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [5.4.0] - 2024-01-31
|
||||
|
||||
### Changed
|
||||
- Updated to Node.js v20 runtime
|
||||
- Updated all dependencies to latest versions
|
||||
|
||||
## [5.3.0] - 2023-09-30
|
||||
|
||||
### Added
|
||||
- **Branch-based versioning mode** (`version_from_branch` input) - Major/minor versions can now be derived from branch names (e.g., `release/v1`, `release/1.2`). Only considers tags matching the branch version, useful for maintaining multiple release lines
|
||||
- Enhanced diagnostics documentation in contributing guide
|
||||
- Improved warning messages to clarify when no tags are found vs when tags exist but don't match criteria
|
||||
|
||||
### Fixed
|
||||
- `GITHUB_REF_NAME` environment variable no longer causes failures during testing
|
||||
- `bump_each_commit` now properly respects `enable_prerelease_mode` setting
|
||||
- Non-version branches are properly ignored when using branch-based versioning
|
||||
|
||||
### Changed
|
||||
- Updated Jest configuration for better test isolation
|
||||
- Rebuilt distribution files with latest changes
|
||||
|
||||
### Deprecated
|
||||
- `use_branches` input is deprecated and will be removed in v6.0.0 - use `version_from_branch` instead
|
||||
|
||||
## [5.2.1] - 2023-08-24
|
||||
|
||||
### Fixed
|
||||
- Diagnostic mode output was not being properly included in the action's output, preventing debugging
|
||||
|
||||
## [5.2.0] - 2023-08-20
|
||||
|
||||
### Added
|
||||
- **Debug/diagnostic mode** (`debug` input) - Captures and outputs diagnostic information for troubleshooting version calculations. Useful when the source repository isn't available for direct inspection
|
||||
|
||||
## [5.1.0] - 2023-08-09
|
||||
|
||||
### Added
|
||||
- **Patch pattern filtering** (`bump_each_commit_patch_pattern` input) - When using `bump_each_commit`, patch version only increments if commit matches specified pattern. Supports JavaScript regex syntax with flags (e.g., `/fix\(.*\)/i`)
|
||||
- **Pre-release mode** (`enable_prerelease_mode` input) - Prevents automatic major version bumps for 0.x.x versions. When enabled, "major" changes become "minor" and "minor" become "patch", preventing premature 1.0.0 releases
|
||||
- `is_tagged` output - Boolean indicating if the current commit already has a version tag
|
||||
- Previous version commit information outputs (`previous_commit`, `previous_version`) for better version tracking
|
||||
|
||||
### Fixed
|
||||
- Corrected tag ordering when determining previous version (was using reverse order incorrectly)
|
||||
- Increased test timeout for Windows environments to prevent CI failures
|
||||
- Fixed test failures in environments with global GPG signing enabled
|
||||
- Documentation typo: "version" output name was incorrectly documented
|
||||
|
||||
## [5.0.3] - 2023-01-10
|
||||
|
||||
### Fixed
|
||||
- Pre-release tags on current commit were not being handled correctly when determining version increments
|
||||
- Fixed incorrect parameter name mapping that was causing action failures
|
||||
|
||||
### Changed
|
||||
- Updated dependencies to latest versions
|
||||
|
||||
## [5.0.2] - 2022-12-31
|
||||
|
||||
### Fixed
|
||||
- Build output mapping was incorrect, causing the action to fail when generating outputs
|
||||
|
||||
## [5.0.1] - 2022-12-27
|
||||
|
||||
### Fixed
|
||||
- Tag prefix and namespace values are now properly escaped when constructing regex patterns, preventing regex errors with special characters
|
||||
- Fixed unescaped dots in regex patterns that could cause incorrect matching
|
||||
- Test suite now consistently uses 'master' as branch name to avoid CI failures
|
||||
|
||||
### Added
|
||||
- Syntax highlighting for code examples in documentation
|
||||
- Contributing.md guide for developers
|
||||
- Test coverage for namespaces containing forward slashes
|
||||
|
||||
### Changed
|
||||
- Documentation updated to reflect correct input parameter names
|
||||
- Version calculation no longer limits the number of tags retrieved, ensuring accurate version determination in repos with many tags
|
||||
|
||||
## [5.0.0] - 2022-12-20 - Major Rewrite
|
||||
|
||||
### Added
|
||||
- **Complete TypeScript rewrite** - Action rewritten from JavaScript to TypeScript with modular architecture
|
||||
- **Author tracking** - New `authors` output lists all commit authors since last release, formatted as CSV (JSON option available via `user_format_type`)
|
||||
- **Commit body searching** - `search_commit_body` input allows searching commit message bodies for version patterns, not just the subject line
|
||||
- **Branch support** - Can now use branch names instead of tags for versioning with `use_branches` input
|
||||
- **Improved outputs** - Additional metadata including `version_type`, commit hashes, and more detailed version information
|
||||
- **Namespace support without tags** - Namespaces now work even when no existing tags match the namespace
|
||||
|
||||
### Fixed
|
||||
- Pre-release tags (alpha, beta, rc) are now properly excluded from version calculations unless explicitly included
|
||||
- Fixed issue where current commit's tag wasn't properly considered when calculating previous version
|
||||
- Tag ordering now uses git's version sort instead of author date, providing more accurate version ordering
|
||||
|
||||
### Changed
|
||||
- Architecture completely redesigned with providers, resolvers, classifiers, and formatters for better extensibility
|
||||
- Short tag support has been completely removed (was deprecated in v4)
|
||||
- Updated to actions/core@1.10.0 and modernized all dependencies
|
||||
- Node.js 16 compatibility
|
||||
|
||||
## [4.0.3] - 2021-10-29
|
||||
|
||||
### Changed
|
||||
- Version output now properly uses the user-supplied version format template combined with namespace
|
||||
- Updated dependencies and improved test coverage
|
||||
- Documentation clarifications for better user understanding
|
||||
|
||||
## [4.0.2] - 2021-04-22
|
||||
|
||||
### Fixed
|
||||
- Tag prefixes can now contain forward slashes (e.g., `releases/v`), enabling more flexible tagging schemes
|
||||
|
||||
## [4.0.1] - 2021-02-25
|
||||
|
||||
### Fixed
|
||||
- Fixed regex pattern for matching full version tags when `short_tags` is disabled
|
||||
|
||||
## [4.0.0] - 2021-02-08
|
||||
|
||||
### Changed
|
||||
- **Breaking**: Branch parameter now defaults to `HEAD` instead of requiring explicit branch name
|
||||
- Branch names no longer include `origin/` prefix, simplifying branch-based versioning
|
||||
- Reintroduced support for using `HEAD` as branch parameter (was removed in v3)
|
||||
|
||||
### Deprecated
|
||||
- `branch` input is now deprecated in favor of automatic HEAD detection
|
||||
|
||||
## [3.3.1] - 2021-01-28
|
||||
|
||||
### Added
|
||||
- `version_tag` output now includes namespace value, making it easier to identify versioned releases in multi-project repositories
|
||||
|
||||
### Changed
|
||||
- Improved documentation clarity for namespace feature
|
||||
- Enhanced readme formatting and examples
|
||||
|
||||
## [3.3.0] - 2021-01-23
|
||||
|
||||
### Added
|
||||
- **Regular expression support** for `major_pattern` and `minor_pattern` - Wrap patterns in `/` to use regex (e.g., `/breaking:\s/i`)
|
||||
|
||||
### Fixed
|
||||
- Fixed logic that prevented version tags from being properly matched when calculating increments
|
||||
|
||||
## [3.2.1] - 2021-01-16
|
||||
|
||||
### Fixed
|
||||
- Tagged commits now properly preserve their increment value instead of resetting to 0
|
||||
- SVG diagrams now have proper background color for better visibility
|
||||
|
||||
### Changed
|
||||
- Updated dependencies
|
||||
- Documentation improvements
|
||||
|
||||
## [3.2.0] - 2020-12-20
|
||||
|
||||
### Added
|
||||
- **`bump_each_commit` mode** - Every commit creates a new patch version, useful for continuous deployment scenarios
|
||||
- **`short_tags` toggle** - When set to `false`, only full semantic version tags (e.g., v1.2.3) are considered, ignoring short tags (e.g., v1)
|
||||
|
||||
### Changed
|
||||
- Improved documentation with visual diagrams
|
||||
- Removed deprecated parameters from documentation
|
||||
- Enhanced readme clarity with better examples
|
||||
|
||||
## [3.1.2] - 2020-10-07
|
||||
|
||||
### Fixed
|
||||
- **Full Windows support** - Fixed line ending issues and command execution on Windows
|
||||
- Action now properly exits when current commit already has a version tag
|
||||
- Current commit's tag is now used as the version when applicable
|
||||
|
||||
### Added
|
||||
- Complete Windows support in test suite with OS-specific temp directories
|
||||
- Windows runner added to CI pipeline alongside Linux
|
||||
|
||||
### Changed
|
||||
- Commands now run silently to reduce log noise
|
||||
- Improved error handling for command execution failures
|
||||
- Added warning about actions/checkout@v2 shallow clone behavior that can affect version detection
|
||||
|
||||
## [3.1.1] - 2020-09-05
|
||||
|
||||
### Fixed
|
||||
- Change detection now works correctly when no previous tags exist in the repository
|
||||
|
||||
## [3.1.0] - 2020-09-05
|
||||
|
||||
### Added
|
||||
- **`version_tag` output** - Returns the complete version tag including prefix and namespace
|
||||
|
||||
### Changed
|
||||
- Improved logging for change detection to help with debugging
|
||||
- Command execution failures are now logged as info rather than errors (they're handled gracefully)
|
||||
- Updated package dependencies
|
||||
|
||||
## [3.0.0] - 2020-09-02 - Multi-Project Support
|
||||
|
||||
### Added
|
||||
- **Namespace support** (`namespace` input) - Enables multiple projects/components in same repo with isolated versioning
|
||||
- **Improved mono-repo support** - Each namespace maintains its own version sequence
|
||||
|
||||
### Changed
|
||||
- **Breaking**: `change_path` input now filters which paths trigger version changes rather than just detecting changes
|
||||
- Removed verbose action output for cleaner logs
|
||||
- Modernized codebase and dependencies for GitHub Actions runner compatibility
|
||||
|
||||
### Removed
|
||||
- Deprecated action inputs from v2
|
||||
|
||||
## [2.1.1] - 2020-02-07
|
||||
|
||||
### Fixed
|
||||
- Release link generation now uses correct branch name format
|
||||
|
||||
## [2.1.0] - 2020-01-25
|
||||
|
||||
### Added
|
||||
- **Path-based change detection** (`change_path` input) - Specify paths to monitor for changes, useful for mono-repos where not all changes should trigger version bumps
|
||||
|
||||
### Changed
|
||||
- Release link now uses branch name from action input rather than GitHub environment variable
|
||||
- Release link is now output to action logs for visibility
|
||||
|
||||
## [2.0.0] - 2019-12-24
|
||||
|
||||
### Changed
|
||||
- **Breaking**: Now uses `git describe` for more reliable tag detection instead of `git log`
|
||||
- Added warning when repository has no tags, helping users understand why versioning starts at 0.0.0
|
||||
|
||||
## [1.0.1] - 2019-12-11
|
||||
|
||||
### Fixed
|
||||
- Empty tag prefixes are now supported (useful for repos that use plain version numbers without 'v' prefix)
|
||||
|
||||
### Added
|
||||
- Documentation for `version_format` input parameter
|
||||
|
||||
## [1.0.0] - 2019-12-11 - Initial Release
|
||||
|
||||
### Added
|
||||
- Automatic semantic versioning based on git commit history
|
||||
- Version bumping through commit message markers: `(MAJOR)` and `(MINOR)`
|
||||
- Customizable version output format via `version_format` input
|
||||
- Support for both short (v1) and full (v1.0.0) version tags
|
||||
- Increment counter for commits since last version tag
|
||||
- No manual version maintenance required - fully automated from git history
|
||||
|
||||
[5.4.0]: https://github.com/PaulHatch/semantic-version/compare/v5.3.0...v5.4.0
|
||||
[5.3.0]: https://github.com/PaulHatch/semantic-version/compare/v5.2.1...v5.3.0
|
||||
[5.2.1]: https://github.com/PaulHatch/semantic-version/compare/v5.2.0...v5.2.1
|
||||
[5.2.0]: https://github.com/PaulHatch/semantic-version/compare/v5.1.0...v5.2.0
|
||||
[5.1.0]: https://github.com/PaulHatch/semantic-version/compare/v5.0.3...v5.1.0
|
||||
[5.0.3]: https://github.com/PaulHatch/semantic-version/compare/v5.0.2...v5.0.3
|
||||
[5.0.2]: https://github.com/PaulHatch/semantic-version/compare/v5.0.1...v5.0.2
|
||||
[5.0.1]: https://github.com/PaulHatch/semantic-version/compare/v5.0.0...v5.0.1
|
||||
[5.0.0]: https://github.com/PaulHatch/semantic-version/compare/v4.0.3...v5.0.0
|
||||
[4.0.3]: https://github.com/PaulHatch/semantic-version/compare/v4.0.2...v4.0.3
|
||||
[4.0.2]: https://github.com/PaulHatch/semantic-version/compare/v4.0.1...v4.0.2
|
||||
[4.0.1]: https://github.com/PaulHatch/semantic-version/compare/v4...v4.0.1
|
||||
[4.0.0]: https://github.com/PaulHatch/semantic-version/compare/v3.3.1...v4
|
||||
[3.3.1]: https://github.com/PaulHatch/semantic-version/compare/v3.3...v3.3.1
|
||||
[3.3.0]: https://github.com/PaulHatch/semantic-version/compare/v3.2.1...v3.3
|
||||
[3.2.1]: https://github.com/PaulHatch/semantic-version/compare/v3.2...v3.2.1
|
||||
[3.2.0]: https://github.com/PaulHatch/semantic-version/compare/v3.1.2...v3.2
|
||||
[3.1.2]: https://github.com/PaulHatch/semantic-version/compare/v3.1.1...v3.1.2
|
||||
[3.1.1]: https://github.com/PaulHatch/semantic-version/compare/v3.1...v3.1.1
|
||||
[3.1.0]: https://github.com/PaulHatch/semantic-version/compare/v3...v3.1
|
||||
[3.0.0]: https://github.com/PaulHatch/semantic-version/compare/v2.1.1...v3
|
||||
[2.1.1]: https://github.com/PaulHatch/semantic-version/compare/v2.1...v2.1.1
|
||||
[2.1.0]: https://github.com/PaulHatch/semantic-version/compare/v2...v2.1
|
||||
[2.0.0]: https://github.com/PaulHatch/semantic-version/compare/v1.0.1...v2
|
||||
[1.0.1]: https://github.com/PaulHatch/semantic-version/compare/v1...v1.0.1
|
||||
[1.0.0]: https://github.com/PaulHatch/semantic-version/releases/tag/v1
|
||||
|
|
@ -23,7 +23,7 @@ inputs:
|
|||
major_pattern:
|
||||
description: "A string which, if present in a git commit, indicates that a change represents a major (breaking) change. Wrap with '/' to match using a regular expression."
|
||||
required: true
|
||||
default: "(MAJOR)"
|
||||
default: "/!:|BREAKING CHANGE:/"
|
||||
major_regexp_flags:
|
||||
description: "A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs"
|
||||
required: false
|
||||
|
|
@ -31,7 +31,7 @@ inputs:
|
|||
minor_pattern:
|
||||
description: "A string which, if present in a git commit, indicates that a change represents a minor (feature) change. Wrap with '/' to match using a regular expression."
|
||||
required: true
|
||||
default: "(MINOR)"
|
||||
default: "/feat:/"
|
||||
minor_regexp_flags:
|
||||
description: "A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs"
|
||||
required: false
|
||||
|
|
@ -101,5 +101,5 @@ outputs:
|
|||
description: "Diagnostic information, if debug is enabled"
|
||||
|
||||
runs:
|
||||
using: "node16"
|
||||
using: "node20"
|
||||
main: "dist/index.js"
|
||||
|
|
@ -20,7 +20,7 @@ There is a debug option which produces diagnostic information. This information
|
|||
|
||||
```
|
||||
- name: Version
|
||||
uses: paulhatch/semantic-version@v5.2.1
|
||||
uses: paulhatch/semantic-version@v5.4.0
|
||||
id: version
|
||||
with:
|
||||
tag_prefix: ""
|
||||
|
|
@ -102,4 +102,4 @@ Additionally a few formatter provide modular behavior to these step:
|
|||
- A version formatter is used to format output version string
|
||||
- A user formatter is used to format the user information in the output (JSON and CSV are provided in the default implementation)
|
||||
|
||||
Each one includes at least one default, but can be replaced by a custom provider by implementing the appropriate interface and updating the `ConfigurationProvider` to return your action instead. This should allow you to continue to merge in changes from the main project as needed with minimal conflict.
|
||||
Each one includes at least one default, but can be replaced by a custom provider by implementing the appropriate interface and updating the `ConfigurationProvider` to return your action instead. This should allow you to continue to merge in changes from the main project as needed with minimal conflict.
|
||||
|
|
|
|||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
91
guide.md
91
guide.md
|
|
@ -1,15 +1,21 @@
|
|||
# Configuration Guide
|
||||
|
||||
WIP
|
||||
|
||||
## Choosing a Release Strategy
|
||||
|
||||
This section is designed to help you choose a release strategy for your project and help you configure GitHub Workflow to use that strategy. It is organized starting from the most simple with each strategy supporting more complex needs, allowing you to start at the top and continue until you find the simplest strategy that meets your needs.
|
||||
|
||||
Note that in the examples given `latest` is used, but you will likely want to pin your version to a specific version.
|
||||
|
||||
### Increment Every Release
|
||||
|
||||
If your project has no gating requirements and you want to release every time a commit is pushed to the default branch, you can use the _Increment Every Release_ strategy. This may be appropriate for documentation projects, very small projects, or in cases where "shipping" a broken version isn't a big deal. The key limitation of this strategy is that once you push a commit, the version is going to increments no matter what. If you push a version and your build or automated tests fail, you'll have a version that is broken and you'll have to increment the version again to fix it.
|
||||
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@latest
|
||||
with:
|
||||
bump_each_commit: true
|
||||
```
|
||||
|
||||
### Increment from Commit Message
|
||||
|
||||
Very similar to the strategy above, using the _Increment from Commit Message_ means that you are making the decision to increment the version at the time you commit the code, however by using the `bump_each_commit_patch_pattern` parameter introduced in v5.1.0, you can prevent the version from incrementing for a commit unless it matches one of the patters (major, minor, or patch).
|
||||
|
|
@ -18,24 +24,83 @@ Compared to the _Increment Every Release_ strategy, this strategy allows you to
|
|||
|
||||
On the other hand, if you have a fast deployment strategy, such as "every commit goes to prod" and don't mind versions being created for failed builds, this may be the right choice.
|
||||
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@latest
|
||||
with:
|
||||
bump_each_commit: true
|
||||
bump_each_commit_patch_pattern: "(PATCH)"
|
||||
```
|
||||
|
||||
|
||||
### Tag Versioning
|
||||
|
||||
This strategy is the most common and is the best option for many projects. It allows you to make the decision to release a version after the build has run, which is essentially the primary motivation and main purpose for this action.
|
||||
|
||||
The only real limitation of this strategy is that it does not allow for multiple versions to receive ongoing updates, which may be necessary for certain types of projects which are distributed and receive ongoing maintenance of older versions. This is in contrast to projects that are developed only for a single deployment and are not distributed.
|
||||
|
||||
Tags should generally not be created automatically as part of the build, which can cause strange behavior unless you've taken care to prevent race conditions. Creating tags automatically also largely negates the purpose of this strategy as only build automated test.
|
||||
Tags should generally not be created automatically as part of the build, which can cause strange behavior unless you've taken care to prevent race conditions. Creating tags automatically also largely negates the purpose of this strategy.
|
||||
|
||||
> Remaining strategies are still a work in progress.
|
||||
_This is the default behavior, so no special options are required._
|
||||
|
||||
## Branch Versioning
|
||||
|
||||
Moving past tag versioning is where things get a little more complicated, as there are many different ways to version branches.
|
||||
|
||||
### Version Branches with Tag Versioning
|
||||
### Version from Branch Name (Non-Predictive)
|
||||
### Version from Branch Name (Predictive)
|
||||
|
||||
## Branch Versioning: GitFlow
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@latest
|
||||
```
|
||||
|
||||
|
||||
### Branch + Tag Versioning
|
||||
|
||||
So far all the options considered have assumed that a single, ever incrementing version is being released, and that once a new major or minor version is tagged no further updates are made for previous versions. This is appropriate for many projects such as web applications and most libraries, however if you need to support on-going update to multiple major or major+minor versions, using only the approaches above can lead to problems if you are merging updates into multiple branches, as any tags may be picked up and cause the version of an older branch to unexpectedly jump.
|
||||
|
||||
To accomplish this, we can enable the `version_from_branch`, which will cause the major and optionally the minor version to be taken from the current branch name rather than the tag, and to filter out tags that do not begin with the same version number(s). The `version_from_branch` input can be either a boolean or a regex string to be used to identify the version from the branch name. By default this will be `[0-9]+.[0-9]+$|[0-9]+$` e.g. match the final number or pair of numbers separated by a `.`. This default is probably appropriate for the majority of cases as it will match any prefix, for example branches named:
|
||||
|
||||
- `release/v1`
|
||||
- `release/v1.2`
|
||||
- `v1`
|
||||
- `v1.2`
|
||||
- `1`
|
||||
- `1.2`
|
||||
|
||||
Note that when using this strategy you should always tag at the same time as the branch is created to ensure that the increment value is correct.
|
||||
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@latest
|
||||
with:
|
||||
version_from_branch: true
|
||||
```
|
||||
|
||||
Alternately, you can override the branch pattern.
|
||||
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@latest
|
||||
with:
|
||||
version_from_branch: "/v([0-9]+.[0-9]+$|[0-9]+)$/"
|
||||
```
|
||||
|
||||
## Namespace Services / "Monorepo" Support
|
||||
|
||||
If your project contains multiple services which you wish to version independently, you can use the `namespace` and `change_path` inputs to provide a version for a specific service which increments only when a file in the specified path is changed. (Or, if you are only build on push/pull requests you can just use the GitHub Action's [`paths`/`paths-ignore`](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onpushpull_requestpull_request_targetpathspaths-ignore) feature to block the trigger itself and run the workflow only when files in a specific path are changed. In contrast this method will also work on other triggers like `workflow_dispatch`.)
|
||||
|
||||
```yaml
|
||||
- id: version
|
||||
uses: paulhatch/semantic-version@latest
|
||||
with:
|
||||
change_path: "src/my-service"
|
||||
namespace: my-service
|
||||
- name: Cancel if Unchanged
|
||||
if: ${{ ! fromJSON(steps.version.outputs.changed) }}
|
||||
run: |
|
||||
gh run cancel ${{ github.run_id }}
|
||||
gh run watch ${{ github.run_id }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
## Additional Configuration
|
||||
|
||||
| Value | Description |
|
||||
| --- | --- |
|
||||
| `tag_prefix` | The prefix to use for the tag. Defaults to `v`, generally you will use either `v` or an empty string. Note that the tag format is distinct from the version. Tags used for versioning must always follow the pattern `{tag_prefix}{major}.{minor}.{patch}` with and optional `-{namespace}` suffix. |
|
||||
| `major_pattern` and `minor_pattern` | These strings are used to determine the type of version to create. If any commit message since matches the `major_pattern` the major version will be incremented, if it matches the `minor_pattern` the minor version will be incremented. If neither pattern matches, the patch version will be incremented. These can be specified either as strings or as regular expression by wrapping the expression in `/`. The defaults follow [Conventional Commits](https://www.conventionalcommits.org/): `/!:|BREAKING CHANGE:/` for major and `/feat:/` for minor. |
|
||||
| `version_format` | A value such as `${major}.${minor}.${patch}-prerelease${increment}` that will be used to format the version value of the output, **formatting this value is the only effect of this input parameter!** It is not used for parsing or any other purpose. It is a convenient alternative to formatting the output in a subsequent step. |
|
||||
| `user_format_type` | Indicates the format of the `authors` output. Can be `json` or `yaml`. |
|
||||
| `enable_prerelease_mode` | If true, major changes to versions starting with 0 will result in a minor change, preventing ths initial version `1.0.0`` from being created automatically by someone checking in a commit with the major pattern. |
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ class ActionConfig {
|
|||
/** If true, the branch will be used to select the maximum version. */
|
||||
this.versionFromBranch = false;
|
||||
/** A string which, if present in a git commit, indicates that a change represents a major (breaking) change. Wrap with '/' to match using a regular expression. */
|
||||
this.majorPattern = "(MAJOR)";
|
||||
this.majorPattern = "/!:|BREAKING CHANGE:/";
|
||||
/** A string which indicates the flags used by the `majorPattern` regular expression. */
|
||||
this.majorFlags = "";
|
||||
/** A string which, if present in a git commit, indicates that a change represents a minor (feature) change. Wrap with '/' to match using a regular expression. */
|
||||
this.minorPattern = "(MINOR)";
|
||||
this.minorPattern = "/feat:/";
|
||||
/** A string which indicates the flags used by the `minorPattern` regular expression. */
|
||||
this.minorFlags = "";
|
||||
/** Pattern to use when formatting output version */
|
||||
|
|
|
|||
261
package-lock.json
generated
261
package-lock.json
generated
|
|
@ -13,17 +13,17 @@
|
|||
"@actions/exec": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.7.1",
|
||||
"@typescript-eslint/parser": "^6.7.3",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^8.50.0",
|
||||
"@types/node": "^20.11.13",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"eslint-plugin-jest": "^27.4.0",
|
||||
"eslint-plugin-jest": "^27.6.3",
|
||||
"jest": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "^3.0.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
"prettier": "^3.2.4",
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
|
|
@ -79,12 +79,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.22.13",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz",
|
||||
"integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==",
|
||||
"version": "7.23.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
|
||||
"integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.22.13",
|
||||
"@babel/highlight": "^7.23.4",
|
||||
"chalk": "^2.4.2"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -211,12 +211,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/generator": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz",
|
||||
"integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==",
|
||||
"version": "7.23.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz",
|
||||
"integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.23.0",
|
||||
"@babel/types": "^7.23.6",
|
||||
"@jridgewell/gen-mapping": "^0.3.2",
|
||||
"@jridgewell/trace-mapping": "^0.3.17",
|
||||
"jsesc": "^2.5.1"
|
||||
|
|
@ -349,9 +349,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz",
|
||||
"integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==",
|
||||
"version": "7.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz",
|
||||
"integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
|
@ -390,9 +390,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/highlight": {
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
|
||||
"integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
|
||||
"version": "7.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
|
||||
"integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
|
|
@ -475,9 +475,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz",
|
||||
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==",
|
||||
"version": "7.23.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz",
|
||||
"integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
|
|
@ -690,20 +690,20 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/traverse": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz",
|
||||
"integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==",
|
||||
"version": "7.23.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz",
|
||||
"integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
"@babel/generator": "^7.23.0",
|
||||
"@babel/code-frame": "^7.23.5",
|
||||
"@babel/generator": "^7.23.6",
|
||||
"@babel/helper-environment-visitor": "^7.22.20",
|
||||
"@babel/helper-function-name": "^7.23.0",
|
||||
"@babel/helper-hoist-variables": "^7.22.5",
|
||||
"@babel/helper-split-export-declaration": "^7.22.6",
|
||||
"@babel/parser": "^7.23.0",
|
||||
"@babel/types": "^7.23.0",
|
||||
"debug": "^4.1.0",
|
||||
"@babel/parser": "^7.23.9",
|
||||
"@babel/types": "^7.23.9",
|
||||
"debug": "^4.3.1",
|
||||
"globals": "^11.1.0"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -720,12 +720,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz",
|
||||
"integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==",
|
||||
"version": "7.23.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz",
|
||||
"integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.22.5",
|
||||
"@babel/helper-string-parser": "^7.23.4",
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
},
|
||||
|
|
@ -764,9 +764,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz",
|
||||
"integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==",
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
|
||||
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
|
|
@ -787,9 +787,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
|
||||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
|
||||
"version": "8.56.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz",
|
||||
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
|
|
@ -802,13 +802,13 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array": {
|
||||
"version": "0.11.11",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
|
||||
"integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
|
||||
"version": "0.11.14",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
|
||||
"integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@humanwhocodes/object-schema": "^1.2.1",
|
||||
"debug": "^4.1.1",
|
||||
"@humanwhocodes/object-schema": "^2.0.2",
|
||||
"debug": "^4.3.1",
|
||||
"minimatch": "^3.0.5"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -829,9 +829,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/object-schema": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
|
||||
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz",
|
||||
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@istanbuljs/load-nyc-config": {
|
||||
|
|
@ -1440,10 +1440,13 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.7.1.tgz",
|
||||
"integrity": "sha512-LT+OIXpp2kj4E2S/p91BMe+VgGX2+lfO+XTpfXhh+bCk2LkQtHZSub8ewFBMGP5ClysPjTDFa4sMI8Q3n4T0wg==",
|
||||
"dev": true
|
||||
"version": "20.11.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.13.tgz",
|
||||
"integrity": "sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.3",
|
||||
|
|
@ -1473,15 +1476,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.3.tgz",
|
||||
"integrity": "sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ==",
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz",
|
||||
"integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -1501,13 +1504,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
|
||||
"integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz",
|
||||
"integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3"
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
|
|
@ -1518,9 +1521,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
|
||||
"integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz",
|
||||
"integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
|
|
@ -1531,16 +1534,17 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
|
||||
"integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz",
|
||||
"integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
"minimatch": "9.0.3",
|
||||
"semver": "^7.5.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
|
|
@ -1558,12 +1562,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
|
||||
"integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz",
|
||||
"integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -1574,6 +1578,30 @@
|
|||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/minimatch": {
|
||||
"version": "9.0.3",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
|
||||
"integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
|
||||
|
|
@ -1822,19 +1850,25 @@
|
|||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@ungap/structured-clone": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
|
||||
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@vercel/ncc": {
|
||||
"version": "0.38.0",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.0.tgz",
|
||||
"integrity": "sha512-B4YKZMm/EqMptKSFyAq4q2SlgJe+VCmEH6Y8gf/E1pTlWbsUJpuH1ymik2Ex3aYO5mCWwV1kaSYHSQOT8+4vHA==",
|
||||
"version": "0.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz",
|
||||
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"ncc": "dist/ncc/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.10.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
|
||||
"integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==",
|
||||
"version": "8.11.3",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
|
|
@ -2969,18 +3003,19 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
|
||||
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
|
||||
"version": "8.56.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz",
|
||||
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@eslint/eslintrc": "^2.1.4",
|
||||
"@eslint/js": "8.56.0",
|
||||
"@humanwhocodes/config-array": "^0.11.13",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
"@ungap/structured-clone": "^1.2.0",
|
||||
"ajv": "^6.12.4",
|
||||
"chalk": "^4.0.0",
|
||||
"cross-spawn": "^7.0.2",
|
||||
|
|
@ -3400,9 +3435,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-jest": {
|
||||
"version": "27.4.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.0.tgz",
|
||||
"integrity": "sha512-ukVeKmMPAUA5SWjHenvyyXnirKfHKMdOsTZdn5tZx5EW05HGVQwBohigjFZGGj3zuv1cV6hc82FvWv6LdIbkgg==",
|
||||
"version": "27.6.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz",
|
||||
"integrity": "sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/utils": "^5.10.0"
|
||||
|
|
@ -3924,9 +3959,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/globals": {
|
||||
"version": "13.22.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.22.0.tgz",
|
||||
"integrity": "sha512-H1Ddc/PbZHTDVJSnj8kWptIRSD6AM3pK+mKytuIVF4uoBV7rshFlhhvA58ceJ5wp3Er58w6zj7bykMpYXt3ETw==",
|
||||
"version": "13.24.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
|
||||
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"type-fest": "^0.20.2"
|
||||
|
|
@ -5839,9 +5874,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
|
||||
"integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz",
|
||||
"integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
|
|
@ -5905,9 +5940,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
|
||||
"integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
|
@ -6535,9 +6570,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/ts-jest": {
|
||||
"version": "29.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz",
|
||||
"integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==",
|
||||
"version": "29.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz",
|
||||
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bs-logger": "0.x",
|
||||
|
|
@ -6553,7 +6588,7 @@
|
|||
"ts-jest": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
"node": "^16.10.0 || ^18.0.0 || >=20.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.0.0-beta.0 <8",
|
||||
|
|
@ -6738,9 +6773,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
|
@ -6765,6 +6800,12 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/untildify": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
||||
|
|
|
|||
16
package.json
16
package.json
|
|
@ -32,16 +32,16 @@
|
|||
"@actions/exec": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.7.1",
|
||||
"@typescript-eslint/parser": "^6.7.3",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^8.50.0",
|
||||
"@types/node": "^20.11.13",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"eslint-plugin-jest": "^27.4.0",
|
||||
"eslint-plugin-jest": "^27.6.3",
|
||||
"jest": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "^3.0.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
"prettier": "^3.2.4",
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
readme.md
22
readme.md
|
|
@ -1,6 +1,6 @@
|
|||

|
||||
|
||||
See [contributing.md](contributing.md) for information on how to get help or contribute to this project.
|
||||
See the [configuration guide](guide.md) for help getting started, selecting a versioning strategy and example configurations, or [contributing.md](contributing.md) for information on how to get help or contribute to this project.
|
||||
|
||||
# Git-Based Semantic Versioning
|
||||
|
||||
|
|
@ -13,8 +13,9 @@ automatically while publishing version that only increment by one value per
|
|||
release. To accomplish this, the next version number is calculated along with
|
||||
a commit increment indicating the number of commits for this version. The
|
||||
commit messages are inspected to determine the type of version change the next
|
||||
version represents. Including the term `(MAJOR)` or `(MINOR)` in the commit
|
||||
message alters the type of change the next version will represent.
|
||||
version represents. By default, this action follows [Conventional Commits](https://www.conventionalcommits.org/)
|
||||
patterns: commits with `feat:` trigger minor version bumps, and commits with a `!` suffix
|
||||
(e.g., `feat!:`, `fix!:`) or containing `BREAKING CHANGE:` trigger major version bumps.
|
||||
|
||||
# Background
|
||||
|
||||
|
|
@ -50,7 +51,8 @@ _Unless the current commit is already tagged, the version produced by this actio
|
|||
## Major and Minor Versions
|
||||
|
||||
The commit messages for the span of commits from the last tag are checked for the
|
||||
presence of the designated terms (`(MAJOR)` or `(MINOR)` by default), if a term
|
||||
presence of version bump patterns. By default, `feat:` triggers a minor version bump,
|
||||
while `!:` (e.g., `feat!:`, `fix!:`) or `BREAKING CHANGE:` triggers a major version bump. If a pattern
|
||||
is encountered that commit is treated as the start of a major or minor version
|
||||
instead of the default patch level. As with normal commits the implied version
|
||||
will only increment by one value since the last tag regardless of how many major
|
||||
|
|
@ -73,17 +75,17 @@ it will be given the new version if the build were to be retriggered, for exampl
|
|||
<!-- start usage -->
|
||||
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@v5.2.3
|
||||
- uses: paulhatch/semantic-version@v5.4.0
|
||||
with:
|
||||
# The prefix to use to identify tags
|
||||
tag_prefix: "v"
|
||||
# A string which, if present in a git commit, indicates that a change represents a
|
||||
# major (breaking) change, supports regular expressions wrapped with '/'
|
||||
major_pattern: "(MAJOR)"
|
||||
major_pattern: "/!:|BREAKING CHANGE:/"
|
||||
# A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs
|
||||
major_regexp_flags: ""
|
||||
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
|
||||
minor_pattern: "(MINOR)"
|
||||
minor_pattern: "/feat:/"
|
||||
# A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs
|
||||
minor_regexp_flags: ""
|
||||
# A string to determine the format of the version output
|
||||
|
|
@ -106,6 +108,8 @@ it will be given the new version if the build were to be retriggered, for exampl
|
|||
enable_prerelease_mode: true
|
||||
# If enabled, diagnostic information will be added to the action output.
|
||||
debug: false
|
||||
# If true, the branch will be used to select the maximum version.
|
||||
version_from_branch: false
|
||||
```
|
||||
|
||||
## Outputs
|
||||
|
|
@ -154,12 +158,12 @@ like `v1.2.3+0-db` could be configured like this:
|
|||
```yaml
|
||||
- name: Application Version
|
||||
id: version
|
||||
uses: paulhatch/semantic-version@v5.2.2
|
||||
uses: paulhatch/semantic-version@v5.4.0
|
||||
with:
|
||||
change_path: "src/service"
|
||||
- name: Database Version
|
||||
id: db-version
|
||||
uses: paulhatch/semantic-version@v5.2.2
|
||||
uses: paulhatch/semantic-version@v5.4.0
|
||||
with:
|
||||
major_pattern: "(MAJOR-DB)"
|
||||
minor_pattern: "(MINOR-DB)"
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ export class ActionConfig {
|
|||
/** If true, the branch will be used to select the maximum version. */
|
||||
public versionFromBranch: string | boolean = false;
|
||||
/** A string which, if present in a git commit, indicates that a change represents a major (breaking) change. Wrap with '/' to match using a regular expression. */
|
||||
public majorPattern: string = "(MAJOR)";
|
||||
public majorPattern: string = "/!:|BREAKING CHANGE:/";
|
||||
/** A string which indicates the flags used by the `majorPattern` regular expression. */
|
||||
public majorFlags: string = "";
|
||||
/** A string which, if present in a git commit, indicates that a change represents a minor (feature) change. Wrap with '/' to match using a regular expression. */
|
||||
public minorPattern: string = "(MINOR)";
|
||||
public minorPattern: string = "/feat:/";
|
||||
/** A string which indicates the flags used by the `minorPattern` regular expression. */
|
||||
public minorFlags: string = "";
|
||||
/** Pattern to use when formatting output version */
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ test('Minor update bumps minor version and resets increment', async () => {
|
|||
const repo = createTestRepo(); // 0.0.0+0
|
||||
|
||||
repo.makeCommit('Initial Commit'); // 0.0.1+0
|
||||
repo.makeCommit('Second Commit (MINOR)'); // 0.1.0+0
|
||||
repo.makeCommit('feat: Second Commit'); // 0.1.0+0
|
||||
const result = await repo.runAction();
|
||||
|
||||
expect(result.formattedVersion).toBe('0.1.0+0');
|
||||
|
|
@ -131,7 +131,7 @@ test('Major update bumps major version and resets increment', async () => {
|
|||
const repo = createTestRepo(); // 0.0.0+0
|
||||
|
||||
repo.makeCommit('Initial Commit'); // 0.0.1+0
|
||||
repo.makeCommit('Second Commit (MAJOR)'); // 1.0.0+0
|
||||
repo.makeCommit('feat!: Second Commit'); // 1.0.0+0
|
||||
const result = await repo.runAction();
|
||||
|
||||
|
||||
|
|
@ -142,8 +142,8 @@ test('Multiple major commits are idempotent', async () => {
|
|||
const repo = createTestRepo(); // 0.0.0+0
|
||||
|
||||
repo.makeCommit('Initial Commit'); // 0.0.1+0
|
||||
repo.makeCommit('Second Commit (MAJOR)'); // 1.0.0+0
|
||||
repo.makeCommit('Third Commit (MAJOR)'); // 1.0.0+1
|
||||
repo.makeCommit('feat!: Second Commit'); // 1.0.0+0
|
||||
repo.makeCommit('fix!: Third Commit'); // 1.0.0+1
|
||||
const result = await repo.runAction();
|
||||
|
||||
|
||||
|
|
@ -154,8 +154,8 @@ test('Minor commits after a major commit are ignored', async () => {
|
|||
const repo = createTestRepo(); // 0.0.0+0
|
||||
|
||||
repo.makeCommit('Initial Commit'); // 0.0.1+0
|
||||
repo.makeCommit('Second Commit (MAJOR)'); // 1.0.0+0
|
||||
repo.makeCommit('Third Commit (MINOR)'); // 1.0.0+1
|
||||
repo.makeCommit('feat!: Second Commit'); // 1.0.0+0
|
||||
repo.makeCommit('feat: Third Commit'); // 1.0.0+1
|
||||
const result = await repo.runAction();
|
||||
|
||||
expect(result.formattedVersion).toBe('1.0.0+1');
|
||||
|
|
@ -348,6 +348,23 @@ test('Namespace is tracked separately', async () => {
|
|||
expect(subprojectResult.formattedVersion).toBe('0.1.1+0');
|
||||
}, timeout);
|
||||
|
||||
|
||||
test('Version Namespace is tracked separately', async () => {
|
||||
const repo = createTestRepo({ tagPrefix: '' }); // 0.0.0
|
||||
|
||||
repo.makeCommit('Initial Commit'); // 0.0.1
|
||||
repo.exec('git tag 0.0.1');
|
||||
repo.makeCommit('Second Commit'); // 0.0.2
|
||||
repo.exec('git tag subproject0.1.0');
|
||||
repo.makeCommit('Third Commit'); // 0.0.2 / 0.1.1
|
||||
|
||||
const result = await repo.runAction();
|
||||
const subprojectResult = await repo.runAction({ tagPrefix: "subproject" });
|
||||
|
||||
expect(result.formattedVersion).toBe('0.0.2+1');
|
||||
expect(subprojectResult.formattedVersion).toBe('0.1.1+0');
|
||||
}, timeout);
|
||||
|
||||
test('Namespace allows dashes', async () => {
|
||||
const repo = createTestRepo({ tagPrefix: '' }); // 0.0.0
|
||||
|
||||
|
|
@ -416,11 +433,11 @@ test('Bump each commit works', async () => {
|
|||
expect((await repo.runAction()).formattedVersion).toBe('0.0.2+0');
|
||||
repo.makeCommit('Third Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.0.3+0');
|
||||
repo.makeCommit('Fourth Commit (MINOR)');
|
||||
repo.makeCommit('feat: Fourth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0+0');
|
||||
repo.makeCommit('Fifth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.1+0');
|
||||
repo.makeCommit('Sixth Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Sixth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.0.0+0');
|
||||
repo.makeCommit('Seventh Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.0.1+0');
|
||||
|
|
@ -683,7 +700,7 @@ test('Correct previous version is returned when directly tagged with multiple pr
|
|||
test('Prerelease suffixes are ignored', async () => {
|
||||
const repo = createTestRepo();
|
||||
|
||||
repo.makeCommit('Initial Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Initial Commit');
|
||||
repo.makeCommit(`Second Commit`);
|
||||
repo.exec('git tag v1.0.0-alpha.1')
|
||||
repo.makeCommit(`Third Commit`);
|
||||
|
|
@ -695,7 +712,7 @@ test('Prerelease suffixes are ignored', async () => {
|
|||
test('Prerelease suffixes are ignored when namespaces are set', async () => {
|
||||
const repo = createTestRepo({ namespace: 'test' });
|
||||
|
||||
repo.makeCommit('Initial Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Initial Commit');
|
||||
repo.exec('git tag v1.0.0-test')
|
||||
repo.makeCommit(`Second Commit`);
|
||||
repo.exec('git tag v1.0.1-test-alpha.1')
|
||||
|
|
@ -844,23 +861,24 @@ test('Patch pattern increment is correct/matches non-bumped on empty repo', asyn
|
|||
|
||||
}, timeout);
|
||||
|
||||
test('Patch pattern applied when present', async () => {
|
||||
test('Patch pattern applied when present using tag as initial version', async () => {
|
||||
const repo = createTestRepo({ tagPrefix: '', versionFormat: "${major}.${minor}.${patch}+${increment}", bumpEachCommit: true, bumpEachCommitPatchPattern: '(PATCH)' });
|
||||
|
||||
|
||||
repo.makeCommit('Initial Commit');
|
||||
const firstResult = await repo.runAction();
|
||||
repo.exec('git tag 1.0.1');
|
||||
const firstResult = await repo.runAction(); // 1.0.1+0
|
||||
repo.makeCommit('Second Commit');
|
||||
const secondResult = await repo.runAction();
|
||||
const secondResult = await repo.runAction(); // 1.0.1+1
|
||||
repo.makeCommit('Third Commit (PATCH)');
|
||||
const thirdResult = await repo.runAction();
|
||||
const thirdResult = await repo.runAction(); // 1.0.2+0
|
||||
repo.makeCommit('fourth Commit');
|
||||
const fourthResult = await repo.runAction();
|
||||
const fourthResult = await repo.runAction(); // 1.0.2+1
|
||||
|
||||
expect(firstResult.formattedVersion).toBe('0.0.1+0');
|
||||
expect(secondResult.formattedVersion).toBe('0.0.1+1');
|
||||
expect(thirdResult.formattedVersion).toBe('0.0.2+0');
|
||||
expect(fourthResult.formattedVersion).toBe('0.0.2+1');
|
||||
expect(firstResult.formattedVersion).toBe('1.0.1+0');
|
||||
expect(secondResult.formattedVersion).toBe('1.0.1+1');
|
||||
expect(thirdResult.formattedVersion).toBe('1.0.2+0');
|
||||
expect(fourthResult.formattedVersion).toBe('1.0.2+1');
|
||||
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -938,12 +956,12 @@ test('Pre-release mode does not update major version if major version is 0', asy
|
|||
|
||||
repo.makeCommit('Initial Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.0.1');
|
||||
repo.makeCommit('Second Commit (MINOR)');
|
||||
repo.makeCommit('feat: Second Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.0.1');
|
||||
repo.makeCommit('Third Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Third Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0');
|
||||
repo.exec('git tag 0.1.0');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.2.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -954,12 +972,12 @@ test('Pre-release mode updates major version if major version is not 0', async (
|
|||
repo.exec('git tag 1.0.0');
|
||||
repo.makeCommit('Second Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.0.1');
|
||||
repo.makeCommit('Third Commit (MINOR)');
|
||||
repo.makeCommit('feat: Third Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.1.0');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('2.0.0');
|
||||
repo.exec('git tag 2.0.0');
|
||||
repo.makeCommit('Fifth Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Fifth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('3.0.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -977,12 +995,12 @@ test('Tagged commit is flagged as release', async () => {
|
|||
expect(result.formattedVersion).toBe('1.0.1-prerelease.0')
|
||||
expect(result.isTagged).toBe(false);
|
||||
|
||||
repo.makeCommit('Third Commit (MINOR)');
|
||||
repo.makeCommit('feat: Third Commit');
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.0');
|
||||
expect(result.isTagged).toBe(false);
|
||||
|
||||
repo.makeCommit('Fourth Commit (MINOR)');
|
||||
repo.makeCommit('feat: Fourth Commit');
|
||||
repo.exec('git tag v1.1.0')
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.1');
|
||||
|
|
@ -995,12 +1013,12 @@ test('Pre-release mode with bump each commit does not update major version if ma
|
|||
|
||||
repo.makeCommit('Initial Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.0.1');
|
||||
repo.makeCommit('Second Commit (MINOR)');
|
||||
repo.makeCommit('feat: Second Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0');
|
||||
repo.makeCommit('Third Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Third Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.2.0');
|
||||
repo.exec('git tag 0.1.0');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.2.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -1019,7 +1037,7 @@ test('Pre-release mode with bump each commit does not update major version if ma
|
|||
expect((await repo.runAction()).formattedVersion).toBe('0.0.1.1');
|
||||
repo.makeCommit('Third Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.0.1.2');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -1115,12 +1133,12 @@ test('Prerelease mode does not increment to 1.x.x', async () => {
|
|||
expect(result.formattedVersion).toBe('1.0.1-prerelease.0')
|
||||
expect(result.isTagged).toBe(false);
|
||||
|
||||
repo.makeCommit('Third Commit (MINOR)');
|
||||
repo.makeCommit('feat: Third Commit');
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.0');
|
||||
expect(result.isTagged).toBe(false);
|
||||
|
||||
repo.makeCommit('Fourth Commit (MINOR)');
|
||||
repo.makeCommit('feat: Fourth Commit');
|
||||
repo.exec('git tag v1.1.0')
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.1');
|
||||
|
|
|
|||
Loading…
Reference in a new issue