Skip to content

Commit

Permalink
Update releases.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
xhilmi authored Aug 3, 2024
1 parent ddf86a4 commit 6afc4c0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ jobs:
echo "DESCRIPTION=$description" >> $GITHUB_ENV
echo "::set-output name=version::$current_version"
echo "::set-output name=description::$description"
- name: Delete Existing Tag and Release if Exists
run: |
tag_name="alucard-${{ steps.versioning.outputs.version }}"
release_id=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/$tag_name" | jq -r '.id')
if [ "$release_id" != "null" ]; then
echo "Deleting existing release with ID: $release_id"
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/$release_id"
fi
if git rev-parse "$tag_name" >/dev/null 2>&1; then
echo "Deleting existing tag: $tag_name"
git tag -d "$tag_name"
git push origin --delete "$tag_name"
fi
- name: Create Git Tag
run: |
Expand All @@ -75,9 +91,8 @@ jobs:
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
USER_TOKEN: ${{ secrets.USER_TOKEN }}
with:
token: ${{ secrets.USER_TOKEN }}
tag_name: "alucard-${{ steps.versioning.outputs.version }}"
release_name: "alucard-${{ steps.versioning.outputs.version }}"
body: "${{ steps.versioning.outputs.description }}"
Expand Down

0 comments on commit 6afc4c0

Please sign in to comment.