Actions35
- Cleaning Actions
- Coercion Actions
- Comparison Actions
- Increment Actions
- Parsing Actions
- Range Actions
- Sorting Actions
- Validation Actions
Overview
This node provides utilities for comparing semantic version numbers, specifically supporting the "Compare Build" operation which compares two versions including their build metadata. It is useful in scenarios where you need to determine the ordering or equality of software versions that follow semantic versioning, including detailed comparison beyond just major, minor, and patch numbers by considering build metadata.
Practical examples include:
- Automating deployment pipelines to decide if a new build should be promoted based on version comparison.
- Validating version upgrades in package management systems.
- Comparing versions with build metadata to ensure exact matches or ordering in CI/CD workflows.
Properties
| Name | Meaning |
|---|---|
| Version 1 | The first semantic version string to compare (e.g., "1.2.3"). |
| Version 2 | The second semantic version string to compare (e.g., "1.2.4"). |
| Options | Collection of optional flags: • Loose: Use loose parsing for version strings (boolean). • Include Prerelease: Include prerelease versions in range matching (boolean). • RTL (Right to Left): Coerce version strings right to left (boolean, only shown for coercion resource). |
Output
The output JSON contains the following structure:
{
"operation": "compareBuild",
"version1": "string",
"version2": "string",
"result": number
}
operation: The performed operation name ("compareBuild").version1: The first input version string.version2: The second input version string.result: A numeric value indicating the comparison result:-1if version1 < version2,0if version1 == version2,1if version1 > version2.
No binary data output is produced by this node.
Dependencies
- This node depends on the external
semverlibrary for semantic version parsing and comparison. - No external API keys or services are required.
- No special environment variables or n8n credentials are needed.
Troubleshooting
- Invalid version strings: If either version string is not a valid semantic version, the comparison may fail or return unexpected results. Ensure inputs conform to semantic versioning standards.
- Loose parsing option: If enabled, the node attempts to parse non-strict version strings but may produce less predictable results.
- Error messages: Common errors include invalid version format or unknown resource/operation. Verify that the resource is set to "comparison" and operation to "compareBuild".
- To resolve errors, check input version formats and options, and enable "Continue On Fail" if you want the workflow to proceed despite individual item errors.