File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }})
You can’t perform that action at this time.
0 commit comments