Skip to content

Commit

Permalink
Delete the tag, too, when necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
paveloom committed Oct 23, 2022
1 parent 4c4308a commit 6ae9838
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
22 changes: 19 additions & 3 deletions .github/scripts/delete_release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
# A script to delete a GitHub release if it exists

# Get the release ID
RELEASE_ID=$(curl -H "Accept: application/vnd.github.v3+json" "${GH_REPO}"/tags/v"${LBRY_VERSION}" 2>/dev/null | jq '.id')
RELEASE_ID=$(
curl \
-s \
-H "Accept: application/vnd.github+json" \
"${GH_REPO}"/releases/tags/"${TAG}" \
2>/dev/null | jq '.id'
)

if [ "${RELEASE_ID}" != "null" ]; then
# Delete the release
curl -u paveloom:"${GH_TOKEN}" -X DELETE -H "Accept: application/vnd.github.v3+json" "${GH_REPO}"/"${RELEASE_ID}"
# Delete the release
curl \
-su paveloom:"${GH_TOKEN}" \
-X DELETE \
-H "Accept: application/vnd.github+json" \
"${GH_REPO}/releases/${RELEASE_ID}"
# Delete the tag
curl \
-su paveloom:"${GH_TOKEN}" \
-X DELETE \
-H "Accept: application/vnd.github+json" \
"${GH_REPO}/git/refs/tags/${TAG}"
fi
11 changes: 6 additions & 5 deletions .github/workflows/Build & Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true

env:
LBRY_VERSION: ${{ github.event.inputs.version }}
VERSION: ${{ github.event.inputs.version }}
SCRIPTS_BRANCH: master

defaults:
Expand All @@ -34,7 +34,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: lbryio/lbry-desktop
ref: v${{ env.LBRY_VERSION }}
ref: v${{ env.VERSION }}
- name: Install Node
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -101,13 +101,14 @@ jobs:
run: curl https://raw.githubusercontent.com/paveloom-f/lbry-desktop/${{ env.SCRIPTS_BRANCH }}/.github/scripts/delete_release.bash | bash
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
GH_REPO: https://api.github.com/repos/paveloom-f/lbry-desktop/releases
GH_REPO: https://api.github.com/repos/paveloom-f/lbry-desktop
TAG: v${{ env.VERSION }}
- name: Create a release
uses: softprops/action-gh-release@v1
with:
body: Use at your own risk.
name: ${{ env.LBRY_VERSION }}
tag_name: v${{ env.LBRY_VERSION }}
name: ${{ env.VERSION }}
tag_name: v${{ env.VERSION }}
files: |
Linux/latest-linux.yml
Linux/LBRY_*.deb
Expand Down

0 comments on commit 6ae9838

Please sign in to comment.