This GitHub Action extracts a Jira-compatible version number from a release version by formatting it appropriately for Jira version management.
The action takes a release version (typically in the format major.minor.patch.build) and converts it to a Jira version format by:
- Extracting the first three components (major.minor.patch)
- Removing any trailing
.0to match Jira's version naming conventions
This action depends on the SonarSource/release-github-actions/get-release-version action to retrieve the release version.
| Output | Description |
|---|---|
jira-version-name |
The Jira-formatted version derived from the release version |
| Variable | Description |
|---|---|
JIRA_VERSION_NAME |
The Jira-formatted version derived from the release version |
- id: jira-version
uses: SonarSource/release-github-actions/get-jira-version@v1
- run: echo "Jira version is ${{ steps.jira-version.outputs.jira-version-name }}"
# alternatively, you can access the version as an environment variable
- uses: SonarSource/release-github-actions/get-jira-version@v1
- run: echo "Jira version is ${{ env.JIRA_VERSION_NAME }}"
If the release version is 1.2.3.45, the action will:
- Extract
1.2.3(first three components) - Output
jira-version-name=1.2.3and setJIRA_VERSION_NAME=1.2.3
If the release version is 2.1.0.12, the action will:
- Extract
2.1.0(first three components) - Remove trailing
.0to get2.1 - Output
jira-version-name=2.1and setJIRA_VERSION_NAME=2.1
The action uses a bash script that:
- Uses
cutto extract the major.minor.patch components from the release version - Uses
sedto remove trailing.0if present - Sets both the GitHub output (
jira-version-name) and environment variable (JIRA_VERSION_NAME) for the Jira version
- This action is designed to work with semantic versioning patterns
- The trailing
.0removal helps maintain cleaner version names in Jira - The action assumes the release version follows the pattern
major.minor.patch.build