add check if release exists
This commit is contained in:
1 parent
4c0c6b7637
commit
10b202dab3
1 file changed
+16
@@ -39,6 +39,22 @@ jobs:
|
||||
echo "::set-output name=latest_tag::${LATEST_TAG}"
|
||||
echo "::set-output name=publish_date::${PUBLISH_DATE}"
|
||||
|
||||
# 1. Check if the release already exists on Gitea
|
||||
- name: Check if Release Exists
|
||||
id: check_release
|
||||
run: |
|
||||
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}")
|
||||
|
||||
if [ "$HTTP_STATUS" -eq 200 ]; then
|
||||
echo "Release already exists. Skipping step."
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Release does not exist."
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Download latest release
|
||||
run: |
|
||||
DOWNLOAD_URL="https://github.com/prefix-dev/pixi/releases/download/${{ steps.check_release.outputs.latest_tag }}/pixi-x86_64-unknown-linux-musl.tar.gz"
|
||||
|
||||
Reference in new issue
Block a user