Skip to content

Commit d7b421a

Browse files
Merge branch 'master' into fix/version-composer
2 parents 3ebbedb + 27f4748 commit d7b421a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/tags-and-quality.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,20 @@ jobs:
9999
- name: Get version from composer.json
100100
id: get-version
101101
run: |
102-
VERSION=$(grep -oP '"version":\s*"\K[^"]+' composer.json)
102+
VERSION=$(cat composer.json | jq -r '.version')
103+
# Validar formato da versão
104+
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
105+
echo "Invalid version format in composer.json: $VERSION"
106+
echo "Version should be in format x.y.z (e.g., 1.0.21)"
107+
exit 1
108+
fi
103109
echo "version=$VERSION" >> $GITHUB_OUTPUT
104110
echo "Version found: $VERSION"
105111
106112
- name: Check if tag exists
107113
id: check-tag
108114
run: |
109-
if git rev-parse "v${{ steps.get-version.outputs.version }}" >/dev/null 2>&1; then
115+
if git ls-remote --tags origin | grep -q "refs/tags/v${{ steps.get-version.outputs.version }}$"; then
110116
echo "exists=true" >> $GITHUB_OUTPUT
111117
echo "Tag already exists"
112118
else
@@ -121,6 +127,7 @@ jobs:
121127
git config --local user.name "GitHub Action"
122128
git tag -a "v${{ steps.get-version.outputs.version }}" -m "Release v${{ steps.get-version.outputs.version }}"
123129
git push origin "v${{ steps.get-version.outputs.version }}"
130+
echo "Tag v${{ steps.get-version.outputs.version }} created and pushed successfully"
124131
125132
- name: Create Release
126133
if: steps.check-tag.outputs.exists == 'false'

0 commit comments

Comments
 (0)