Skip to content

Commit dc80cdd

Browse files
committed
changed versioning scheme on non release builds
1 parent 7a1342d commit dc80cdd

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@ jobs:
2424
steps:
2525
- name: Get branch name
2626
id: branch-name
27-
uses: tj-actions/branch-names@v8
27+
uses: tj-actions/branch-names@v9
28+
with:
29+
replace_slashes_with_hyphens: true
30+
strip_tag_prefix: v
2831

29-
- name: Generate version string
32+
- name: Generate version
3033
id: version
3134
run: |
32-
BRANCH_NAME="${{ steps.branch-name.outputs.current_branch }}"
33-
# Replace any character that is not a letter, number, or hyphen with a hyphen.
34-
SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cs 'a-zA-Z0-9-' '-')
35-
if [ "$BRANCH_NAME" == "main" ]; then
36-
VERSION="1.0.${{ github.run_number }}"
35+
IS_TAG="${{ steps.branch-name.outputs.is_tag }}"
36+
37+
if [ "$IS_TAG" == "true" ]; then
38+
VERSION="${{ steps.branch-name.outputs.is_tag }}"
3739
else
38-
VERSION="1.0.${{ github.run_number }}-${SANITIZED_BRANCH_NAME}"
40+
VERSION="${{ steps.branch-name.outputs.current_branch }}-${{ github.run_number }}"
3941
fi
4042
echo "value=$VERSION" >> $GITHUB_OUTPUT
43+
echo "Version is: $VERSION"
4144
4245
build:
4346
name: Build (${{ matrix.os }})

0 commit comments

Comments
 (0)