Extracts the version from the name of the current Git branch, returning both.
steps:
- id: detector
uses: giancosta86/aurora-github/actions/detect-branch-version@v4
- run: |
branch="${{ steps.detector.outputs.branch }}"
version="${{ steps.detector.outputs.version }}"
escapedVersion="${{ steps.detector.outputs.escaped-version }}"
major="${{ steps.detector.outputs.major }}"
echo "🔎Detected version '$version' (escaped: '${escapedVersion}') from branch '$branch'"
echo "🔎Major component: '${major}'"
-
the branch name is read from
github.head_ref
if such variable is available - because the action is especially designed for pull-request workflows - and fromgithub.ref
otherwise. -
the branch name should have a semantic version format, optionally preceded by
v
. For example:v1.0.2
.
Name | Type | Description | Default value |
---|---|---|---|
shell |
string | The shell used to run commands | bash |
Name | Type | Description | Example |
---|---|---|---|
branch |
string | The current Git branch | v2.4.8 |
version |
string | The version detected from the branch - always without prefix | 2.4.8 |
escaped-version |
string | The escaped version - for regular expressions | 2.4.8 |
major |
string | The major component of the version |
2 |