Skip to content

Commit

Permalink
ci: fail if tag is not on main
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Oct 28, 2024
1 parent 921a572 commit 597f820
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ jobs:
id: set-release
run: |
mainCount=$(git branch -r --contains ${{ github.ref }} --format "%(refname:lstrip=3)" | grep -xc main)
if [[ $GITHUB_REF =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ && $mainCount -gt 0 ]]; then
if [[ $mainCount -eq 0 ]]; then
echo "Tag was not pushed onto main branch, exiting"
exit 1
elif [[ $GITHUB_REF =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 597f820

Please sign in to comment.