Skip to content

Commit db8de4b

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 2e265df commit db8de4b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,17 @@ jobs:
4444
echo "changed=false" >> $GITHUB_OUTPUT
4545
fi
4646
47-
- name: Check if release already exists
47+
- name: Check if release for current version exists
4848
id: release_exists
4949
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
50+
VERSION_TAG="v${{ steps.versions.outputs.current }}"
51+
if gh release view "$VERSION_TAG" > /dev/null 2>&1; then
5652
echo "exists=true" >> $GITHUB_OUTPUT
5753
else
5854
echo "exists=false" >> $GITHUB_OUTPUT
5955
fi
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6058

6159
- name: Zip Extension Files
6260
run: |
@@ -71,7 +69,7 @@ jobs:
7169
-x "keepcode.zip"
7270
7371
- name: Create Release
74-
if: steps.check_version.outputs.changed == 'true' && steps.release_exists.outputs.exists == 'false'
72+
if: steps.check_version.outputs.changed == 'true' || steps.release_exists.outputs.exists == 'false'
7573
uses: softprops/action-gh-release@v2
7674
with:
7775
tag_name: v${{ steps.versions.outputs.current }}

0 commit comments

Comments
 (0)