Skip to content

Commit

Permalink
Another attempt at fixing release deletion (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored Jan 3, 2025
1 parent 8cba691 commit 8956da2
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,11 @@ jobs:
distribution: 'zulu'
- name: Assemble with Gradle
run: ./gradlew -PcommitCount=$(git rev-list --count master) -PcommitHash=$(git rev-parse --short master) -PstorePassword="${{ secrets.NIGHTLY_KEYSTORE_PASSWORD }}" -PkeyPassword="${{ secrets.NIGHTLY_KEYSTORE_PASSWORD }}" assembleNightlySigned
- name: Delete existing nightly tag
run: git push origin --delete nightly || true
- name: Delete existing nightly release
run: |
TAG_NAME=nightly
# Fetch the release associated with the tag
RESPONSE=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$REPO/releases/tags/$TAG_NAME")
# Check if a release was found
RELEASE_ID=$(echo "$RESPONSE" | jq -r ".id")
if [[ "$RELEASE_ID" == "null" || -z "$RELEASE_ID" ]]; then
echo "No release found for tag: $TAG_NAME"
else
echo "Deleting release with ID: $RELEASE_ID"
curl -s -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$REPO/releases/$RELEASE_ID"
fi
# Delete the tag.
RESPONSE=$(curl -s -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$REPO/git/refs/tags/$TAG_NAME")
# Check for success
if echo "$RESPONSE" | grep -q '"message":'; then
echo "Error: $(echo "$RESPONSE" | jq -r '.message')"
else
echo "Tag '$TAG_NAME' deleted successfully."
fi
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/tags/nightly
- name: Delete existing nightly tag
run: git push origin --delete nightly || true
- name: Release
uses: softprops/action-gh-release@v2
with:
Expand Down

0 comments on commit 8956da2

Please sign in to comment.