Skip to content

Commit f75ee37

Browse files
authored
check if release already exists before drafting
1 parent c1da8c9 commit f75ee37

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/draft-release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ jobs:
1919
API_URL="https://api.github.com/repos/geode-sdk/cli/actions/workflows/build.yml/runs?per_page=1&branch=$BRANCH&event=push&status=success"
2020
RUN_ID=$(curl $API_URL | jq .workflow_runs[0].id)
2121
22+
# test if release already exists
23+
set +e
24+
curl --fail "https://api.github.com/repos/geode-sdk/cli/releases/tags/$VERSION" --silent --output /dev/null
25+
RESULT=$?
26+
set -e
27+
28+
if [ $RESULT -eq 0 ]; then
29+
echo "Release $VERSION already exists! Not replacing it.."
30+
exit 1
31+
fi
32+
2233
echo "version=$VERSION" >> $GITHUB_OUTPUT
2334
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
2435
@@ -76,4 +87,4 @@ jobs:
7687
- Something
7788
draft: true
7889
files: |
79-
./artifacts/*.zip
90+
./artifacts/*.zip

0 commit comments

Comments
 (0)