Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersader committed Dec 10, 2024
1 parent 0d77d57 commit 387b02a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,38 @@ jobs:
run: |
zip -r obsidian-vault-${{ steps.extract_data.outputs.version }}.zip ./*
- name: Check if release already exists
id: check_release
run: |
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.extract_data.outputs.version }})
if [ "$HTTP_STATUS" = "200" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Delete existing release and tag if found
if: steps.check_release.outputs.exists == 'true'
run: |
RELEASE_ID=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.extract_data.outputs.version }} \
| jq -r .id)
# Delete the existing release
curl -s \
-X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID
# Delete the existing tag reference
curl -s \
-X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ steps.extract_data.outputs.version }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
Expand Down

0 comments on commit 387b02a

Please sign in to comment.