Skip to content

Commit 2e265df

Browse files
committed
fix: release.yml now checks if a release exists
if a release doesnt exist for the current version, it creates it on push, if it does, nothing happens
1 parent 8e86434 commit 2e265df

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ jobs:
4444
echo "changed=false" >> $GITHUB_OUTPUT
4545
fi
4646
47+
- name: Check if release already exists
48+
id: release_exists
49+
run: |
50+
TAG="v${{ steps.versions.outputs.current }}"
51+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
52+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
53+
https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG)
54+
55+
if [ "$STATUS" -eq 200 ]; then
56+
echo "exists=true" >> $GITHUB_OUTPUT
57+
else
58+
echo "exists=false" >> $GITHUB_OUTPUT
59+
fi
60+
4761
- name: Zip Extension Files
4862
run: |
4963
rm -f keepcode.zip
@@ -57,7 +71,7 @@ jobs:
5771
-x "keepcode.zip"
5872
5973
- name: Create Release
60-
if: steps.check_version.outputs.changed == 'true'
74+
if: steps.check_version.outputs.changed == 'true' && steps.release_exists.outputs.exists == 'false'
6175
uses: softprops/action-gh-release@v2
6276
with:
6377
tag_name: v${{ steps.versions.outputs.current }}

0 commit comments

Comments
 (0)