Skip to content

Commit

Permalink
Update build-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax authored Sep 16, 2024
1 parent fc33b5e commit cb633ed
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,28 @@ jobs:

- name: Delete existing release and tag if found
run: |
if gh release view v${{ env.VERSION }} > /dev/null 2>&1; then
echo "Release exists"
gh release delete v${{ env.VERSION }} --yes
end
VERSION="v${{ env.VERSION }}"
git tag -d v${{ env.VERSION }} || true
git push origin :refs/tags/v${{ env.VERSION }} || true
if gh release view "$VERSION" > /dev/null 2>&1; then
echo "Release $VERSION exists. Deleting release..."
gh release delete "$VERSION" --yes
else
echo "Release $VERSION does not exist."
fi
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION exists locally. Deleting tag..."
git tag -d "$VERSION" || true
else
echo "Tag $VERSION does not exist locally."
fi
if git ls-remote --tags origin | grep "refs/tags/$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION exists on remote. Deleting remote tag..."
git push origin :refs/tags/"$VERSION" || true
else
echo "Tag $VERSION does not exist on remote."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down

0 comments on commit cb633ed

Please sign in to comment.