Skip to content

Commit

Permalink
Merge pull request #8 from thelastfantasy/v1.2.0-release
Browse files Browse the repository at this point in the history
fix: enhance branch name validation and improve debug output in relea…
  • Loading branch information
thelastfantasy authored Oct 19, 2024
2 parents 39df170 + 945542c commit 49459cd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@ jobs:
- name: Validate branch name and extract version
id: validate_title
run: |
branch_name="${{ github.head_ref }}"
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "Branch name: $branch_name"
echo '1' $GITHUB_REF
echo '2' ${{ github.ref }}
echo '3' ${{ github.ref_name }}
echo '4' ${{ github.head_ref }}
echo '5' ${{ github.base_ref }}
echo '2' $GITHUB_REF
echo '3' $GITHUB_REF_NAME
echo '4' $GITHUB_HEAD_REF
echo '5' $GITHUB_BASE_REF
if [[ "$branch_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
if [[ "$branch_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9-]+)?$ ]]; then
version=$(echo "$branch_name" | grep -oE '^v[0-9]+\.[0-9]+\.[0-9]+')
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Matched version: $version"
else
echo "Branch name does not match the required format (vX.X.X)."
exit 1 # Exit with failure
echo "Branch name does not match the required format (vX.X.X or vX.X.X-suffix)."
exit 1 # Exit with failure
fi
shell: bash

Expand Down

0 comments on commit 49459cd

Please sign in to comment.