Skip to content

Commit ac26c7b

Browse files
committed
Apply a fix for existing releases
1 parent 0939900 commit ac26c7b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/releases.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,28 @@ jobs:
7070
echo | /tmp/bin/minisign -s /tmp/minisign.key -Sm *.tar.gz *.zip
7171
ls -l dnscrypt-proxy*
7272
73+
- name: Check if release exists
74+
id: check_release
75+
if: startsWith(github.ref, 'refs/tags/')
76+
run: |
77+
TAG="${GITHUB_REF#refs/tags/}"
78+
HTTP_CODE=$(curl -s -o response.json -w "%{http_code}" \
79+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
80+
https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG)
81+
if [ "$HTTP_CODE" = "200" ]; then
82+
echo "release_exists=true" >> $GITHUB_ENV
83+
else
84+
echo "release_exists=false" >> $GITHUB_ENV
85+
fi
86+
87+
- name: Debug Release Existence
88+
if: startsWith(github.ref, 'refs/tags/')
89+
run: echo "Release exists? ${{ env.release_exists }}"
90+
7391
- name: Create release
7492
id: create_release
7593
uses: actions/create-release@v1
76-
if: startsWith(github.ref, 'refs/tags/')
94+
if: startsWith(github.ref, 'refs/tags/') && env.release_exists == 'false'
7795
env:
7896
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7997
with:

0 commit comments

Comments
 (0)