File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 run : |
3636 datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
3737 BUILD_DATETIME=$datetime make version-create-effective-file dir=.
38- version=$(head -n 1 .version 2> /dev/null || echo unknown)
38+ branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
39+ if [[ "$branch_name" == "main" ]]; then
40+ version=$(head -n 1 .version 2> /dev/null || echo unknown)
41+ else
42+ # Clean branch name by removing special characters and converting to lowercase
43+ clean_branch=$(echo "$branch_name" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')
44+ version="${clean_branch}"
45+ fi
3946 echo "build_datetime_london=$(TZ=Europe/London date --date=$datetime +'%Y-%m-%dT%H:%M:%S%z')" >> $GITHUB_OUTPUT
4047 echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
4148 echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments