mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
Compare commits
No commits in common. "master" and "v5.4.0" have entirely different histories.
8 changed files with 45 additions and 328 deletions
281
CHANGELOG.md
281
CHANGELOG.md
|
|
@ -1,281 +0,0 @@
|
|||
# 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: "/!:|BREAKING CHANGE:/"
|
||||
default: "(MAJOR)"
|
||||
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: "/feat:/"
|
||||
default: "(MINOR)"
|
||||
minor_regexp_flags:
|
||||
description: "A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs"
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ There is a debug option which produces diagnostic information. This information
|
|||
|
||||
```
|
||||
- name: Version
|
||||
uses: paulhatch/semantic-version@v5.4.0
|
||||
uses: paulhatch/semantic-version@v5.2.1
|
||||
id: version
|
||||
with:
|
||||
tag_prefix: ""
|
||||
|
|
|
|||
6
guide.md
6
guide.md
|
|
@ -78,7 +78,7 @@ Alternately, you can override the branch pattern.
|
|||
|
||||
## 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`.)
|
||||
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.
|
||||
|
||||
```yaml
|
||||
- id: version
|
||||
|
|
@ -87,7 +87,7 @@ If your project contains multiple services which you wish to version independent
|
|||
change_path: "src/my-service"
|
||||
namespace: my-service
|
||||
- name: Cancel if Unchanged
|
||||
if: ${{ ! fromJSON(steps.version.outputs.changed) }}
|
||||
if: ${{ ! steps.version.outputs.changed }}
|
||||
run: |
|
||||
gh run cancel ${{ github.run_id }}
|
||||
gh run watch ${{ github.run_id }}
|
||||
|
|
@ -100,7 +100,7 @@ If your project contains multiple services which you wish to version independent
|
|||
| 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. |
|
||||
| `major_pattern` and `minor_pattern` | These strings are used to determine the type of version to create. If any commit message sincematches 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 `/`. |
|
||||
| `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 = "/!:|BREAKING CHANGE:/";
|
||||
this.majorPattern = "(MAJOR)";
|
||||
/** 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 = "/feat:/";
|
||||
this.minorPattern = "(MINOR)";
|
||||
/** A string which indicates the flags used by the `minorPattern` regular expression. */
|
||||
this.minorFlags = "";
|
||||
/** Pattern to use when formatting output version */
|
||||
|
|
|
|||
20
readme.md
20
readme.md
|
|
@ -1,6 +1,6 @@
|
|||

|
||||
|
||||
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.
|
||||
See [contributing.md](contributing.md) for information on how to get help or contribute to this project.
|
||||
|
||||
# Git-Based Semantic Versioning
|
||||
|
||||
|
|
@ -13,9 +13,8 @@ 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. 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.
|
||||
version represents. Including the term `(MAJOR)` or `(MINOR)` in the commit
|
||||
message alters the type of change the next version will represent.
|
||||
|
||||
# Background
|
||||
|
||||
|
|
@ -51,8 +50,7 @@ _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 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
|
||||
presence of the designated terms (`(MAJOR)` or `(MINOR)` by default), if a term
|
||||
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
|
||||
|
|
@ -75,17 +73,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.4.0
|
||||
- uses: paulhatch/semantic-version@v5.3.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: "/!:|BREAKING CHANGE:/"
|
||||
major_pattern: "(MAJOR)"
|
||||
# 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: "/feat:/"
|
||||
minor_pattern: "(MINOR)"
|
||||
# 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
|
||||
|
|
@ -158,12 +156,12 @@ like `v1.2.3+0-db` could be configured like this:
|
|||
```yaml
|
||||
- name: Application Version
|
||||
id: version
|
||||
uses: paulhatch/semantic-version@v5.4.0
|
||||
uses: paulhatch/semantic-version@v5.3.0
|
||||
with:
|
||||
change_path: "src/service"
|
||||
- name: Database Version
|
||||
id: db-version
|
||||
uses: paulhatch/semantic-version@v5.4.0
|
||||
uses: paulhatch/semantic-version@v5.3.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 = "/!:|BREAKING CHANGE:/";
|
||||
public majorPattern: string = "(MAJOR)";
|
||||
/** 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 = "/feat:/";
|
||||
public minorPattern: string = "(MINOR)";
|
||||
/** 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('feat: Second Commit'); // 0.1.0+0
|
||||
repo.makeCommit('Second Commit (MINOR)'); // 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('feat!: Second Commit'); // 1.0.0+0
|
||||
repo.makeCommit('Second Commit (MAJOR)'); // 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('feat!: Second Commit'); // 1.0.0+0
|
||||
repo.makeCommit('fix!: Third Commit'); // 1.0.0+1
|
||||
repo.makeCommit('Second Commit (MAJOR)'); // 1.0.0+0
|
||||
repo.makeCommit('Third Commit (MAJOR)'); // 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('feat!: Second Commit'); // 1.0.0+0
|
||||
repo.makeCommit('feat: Third Commit'); // 1.0.0+1
|
||||
repo.makeCommit('Second Commit (MAJOR)'); // 1.0.0+0
|
||||
repo.makeCommit('Third Commit (MINOR)'); // 1.0.0+1
|
||||
const result = await repo.runAction();
|
||||
|
||||
expect(result.formattedVersion).toBe('1.0.0+1');
|
||||
|
|
@ -433,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('feat: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MINOR)');
|
||||
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('feat!: Sixth Commit');
|
||||
repo.makeCommit('Sixth Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.0.0+0');
|
||||
repo.makeCommit('Seventh Commit');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.0.1+0');
|
||||
|
|
@ -700,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('feat!: Initial Commit');
|
||||
repo.makeCommit('Initial Commit (MAJOR)');
|
||||
repo.makeCommit(`Second Commit`);
|
||||
repo.exec('git tag v1.0.0-alpha.1')
|
||||
repo.makeCommit(`Third Commit`);
|
||||
|
|
@ -712,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('feat!: Initial Commit');
|
||||
repo.makeCommit('Initial Commit (MAJOR)');
|
||||
repo.exec('git tag v1.0.0-test')
|
||||
repo.makeCommit(`Second Commit`);
|
||||
repo.exec('git tag v1.0.1-test-alpha.1')
|
||||
|
|
@ -956,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('feat: Second Commit');
|
||||
repo.makeCommit('Second Commit (MINOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.0.1');
|
||||
repo.makeCommit('feat!: Third Commit');
|
||||
repo.makeCommit('Third Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0');
|
||||
repo.exec('git tag 0.1.0');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.2.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -972,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('feat: Third Commit');
|
||||
repo.makeCommit('Third Commit (MINOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('1.1.0');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('2.0.0');
|
||||
repo.exec('git tag 2.0.0');
|
||||
repo.makeCommit('feat!: Fifth Commit');
|
||||
repo.makeCommit('Fifth Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('3.0.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -995,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('feat: Third Commit');
|
||||
repo.makeCommit('Third Commit (MINOR)');
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.0');
|
||||
expect(result.isTagged).toBe(false);
|
||||
|
||||
repo.makeCommit('feat: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MINOR)');
|
||||
repo.exec('git tag v1.1.0')
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.1');
|
||||
|
|
@ -1013,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('feat: Second Commit');
|
||||
repo.makeCommit('Second Commit (MINOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0');
|
||||
repo.makeCommit('feat!: Third Commit');
|
||||
repo.makeCommit('Third Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.2.0');
|
||||
repo.exec('git tag 0.1.0');
|
||||
repo.makeCommit('feat!: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.2.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -1037,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('feat!: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MAJOR)');
|
||||
expect((await repo.runAction()).formattedVersion).toBe('0.1.0.0');
|
||||
}, timeout);
|
||||
|
||||
|
|
@ -1133,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('feat: Third Commit');
|
||||
repo.makeCommit('Third Commit (MINOR)');
|
||||
result = await repo.runAction();
|
||||
expect(result.formattedVersion).toBe('1.1.0-prerelease.0');
|
||||
expect(result.isTagged).toBe(false);
|
||||
|
||||
repo.makeCommit('feat: Fourth Commit');
|
||||
repo.makeCommit('Fourth Commit (MINOR)');
|
||||
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