Skip to content

Commit

Permalink
validate if the pr is a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Alleria1809 committed Jul 8, 2024
1 parent 93437c0 commit 55e4993
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ jobs:
- uses: actions/checkout@v3
- name: Validate Tag Format
run: |
TAG_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?$'
echo "Regex to match: $TAG_REGEX"
TAG="${GITHUB_REF/refs\/tags\//}"
echo "Tag extracted: $TAG"
if [[ "$TAG" =~ $TAG_REGEX ]]; then
echo "Tag format is valid."
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?$'
echo "Regex to match: $TAG_REGEX"
TAG="${GITHUB_REF/refs\/tags\//}"
echo "Tag extracted: $TAG"
if [[ "$TAG" =~ $TAG_REGEX ]]; then
echo "Tag format is valid."
else
echo "::error::Tag $TAG does not match the 'vMAJOR.MINOR.PATCH' or 'vMAJOR.MINOR.PATCH-pre-release' format."
exit 1
fi
else
echo "::error::Tag $TAG does not match the 'vMAJOR.MINOR.PATCH' or 'vMAJOR.MINOR.PATCH-pre-release' format."
exit 1
echo "No tag associated with push, skipping tag validation."
exit 78 # Exiting with neutral status
fi
shell: bash

Expand Down Expand Up @@ -134,7 +139,7 @@ jobs:
body: 'Automated release of version ${{ github.ref_name }}'
draft: false
prerelease: false

rollback:
needs: publish-to-pypi
if: ${{ github.event.inputs.rollback == 'true' }}
Expand Down

0 comments on commit 55e4993

Please sign in to comment.